:root {
    --blue: #005caf;
    --blue2: #007ad7;
    --light: #eff7ff;
    --bg: #f5f9fd;
    --green: #37b55b;
    --orange: #f59123;
    --purple: #785cc3;
    --red: #e14141;
    --text: #172334;
    --muted: #5a697d;
    --border: #dce6f0;
    --dark: #121b24;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Arial, sans-serif;
}

/* =========================================================
   LAYOUT PORTALE
   ========================================================= */

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 310px minmax(0, 1fr);
    gap: 0;
}

.sidebar {
    background: #ffffff;
    border-right: 1px solid var(--border);
    padding: 22px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 16px 22px;
    border-bottom: 1px solid rgba(0, 92, 175, 0.12);
    margin-bottom: 14px;
}

.brand-logo-box {
    width: 74px;
    height: 74px;
    border-radius: 18px;
    background: #ffffff;
    border: 1px solid #d7e4f2;
    box-shadow: 0 10px 24px rgba(0, 92, 175, 0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.brand-logo {
    max-width: 64px;
    max-height: 64px;
    object-fit: contain;
    display: block;
}

.brand-text {
    min-width: 0;
}

.brand-title {
    font-weight: 900;
    font-size: 26px;
    color: var(--blue);
    line-height: 1;
}

.brand-subtitle-main {
    color: var(--green);
    font-size: 20px;
    font-weight: 900;
    line-height: 1.1;
    margin-top: 4px;
}

.brand-subtitle {
    font-weight: 800;
    color: var(--muted);
    font-size: 11px;
    margin-top: 6px;
    letter-spacing: 0.06em;
}

.side-nav {
    margin-top: 26px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-link {
    height: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 14px;
    color: var(--text);
    text-decoration: none;
    font-weight: 750;
}

    .nav-link span {
        color: var(--blue);
        width: 24px;
        text-align: center;
    }

    .nav-link:hover,
    .nav-link.active {
        background: var(--light);
        color: var(--blue);
    }

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding-top: 18px;
}

.mini-logo {
    font-size: 22px;
    color: var(--blue);
    font-weight: 900;
}

.sidebar-footer small {
    font-weight: 700;
    color: var(--muted);
}

.main-area {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: 76px;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 26px;
    gap: 18px;
    flex-shrink: 0;
}

.top-title {
    font-size: 18px;
    font-weight: 900;
    color: var(--text);
}

.top-subtitle {
    font-size: 13px;
    color: var(--muted);
    margin-top: 2px;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.language-pill,
.user-pill {
    border: 1px solid var(--border);
    background: #ffffff;
    border-radius: 999px;
    padding: 8px 12px;
    color: var(--muted);
    font-size: 13px;
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
}

.content {
    padding: 20px;
    overflow: auto;
    overflow-x: hidden;
    min-width: 0;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 18px;
    gap: 16px;
}

.page-kicker {
    color: var(--blue);
    font-weight: 900;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.page-title {
    font-size: 30px;
    font-weight: 900;
    margin: 3px 0 0;
}

.page-subtitle {
    color: var(--muted);
    margin-top: 6px;
}

/* =========================================================
   LOGIN
   ========================================================= */

.app-shell.login-page {
    min-height: 100vh;
    width: 100%;
    display: flex !important;
    grid-template-columns: none !important;
    align-items: center;
    justify-content: center;
    padding: 30px;
    background: radial-gradient(circle at top left, rgba(0, 92, 175, 0.12), transparent 34%), radial-gradient(circle at bottom right, rgba(55, 181, 91, 0.12), transparent 32%), #f5f9fd;
}

.login-card {
    width: 460px;
    max-width: calc(100vw - 40px);
    padding: 34px;
    border-radius: 22px;
    background: #ffffff;
    border: 1px solid #dce8f3;
    box-shadow: 0 22px 55px rgba(23, 35, 52, 0.13);
    margin: 0;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 30px;
}

.login-logo-box {
    width: 86px;
    height: 86px;
    border-radius: 22px;
    background: #ffffff;
    border: 1px solid #d7e4f2;
    box-shadow: 0 14px 30px rgba(0, 92, 175, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.login-logo {
    max-width: 76px;
    max-height: 76px;
    object-fit: contain;
    display: block;
}

.login-brand-title {
    color: var(--blue);
    font-size: 28px;
    font-weight: 900;
    line-height: 1;
}

.login-brand-subtitle-main {
    color: var(--green);
    font-size: 22px;
    font-weight: 900;
    line-height: 1.1;
    margin-top: 5px;
}

.login-brand-subtitle {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    margin-top: 7px;
    letter-spacing: 0.5px;
}

.login-button {
    width: 100%;
    margin-top: 8px;
}

.login-demo-text {
    margin-top: 16px;
    text-align: center;
}

/* =========================================================
   CARD / GRID
   ========================================================= */

.card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: 0 8px 24px rgba(20, 35, 55, 0.045);
}

.card-title {
    font-size: 17px;
    font-weight: 900;
    margin-bottom: 16px;
    color: var(--blue);
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.metric {
    border: 1px solid #cfe0f3;
    background: linear-gradient(135deg, #ffffff, var(--light));
    border-radius: 18px;
    padding: 18px;
    position: relative;
    overflow: hidden;
}

    .metric::after {
        content: "";
        position: absolute;
        right: -22px;
        bottom: -28px;
        width: 100px;
        height: 100px;
        border-radius: 999px;
        background: rgba(0, 92, 175, 0.08);
    }

.metric-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.metric strong {
    display: block;
    margin-top: 6px;
    font-size: 32px;
    color: var(--blue);
}

.metric.green strong {
    color: var(--green);
}

.metric.orange strong {
    color: var(--orange);
}

.metric.red strong {
    color: var(--red);
}

/* =========================================================
   FORM
   ========================================================= */

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

    .form-row.three {
        grid-template-columns: 1fr 1fr 1fr;
    }

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-weight: 800;
    margin-bottom: 7px;
}

.form-control,
select,
textarea,
input {
    width: 100%;
    height: 42px;
    border: 1px solid #c8d2dc;
    border-radius: 12px;
    padding: 9px 12px;
    font-family: inherit;
    font-size: 14px;
    background: #ffffff;
    color: var(--text);
}

textarea {
    height: auto;
    min-height: 88px;
}

    .form-control:focus,
    select:focus,
    textarea:focus,
    input:focus {
        outline: none;
        border-color: var(--blue2);
        box-shadow: 0 0 0 3px rgba(0, 122, 215, 0.12);
    }

/* =========================================================
   BUTTON
   ========================================================= */

.btn,
button {
    border: 1px solid var(--blue);
    background: var(--blue);
    color: #ffffff;
    border-radius: 12px;
    padding: 10px 16px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 850;
    cursor: pointer;
    font-family: inherit;
}

    .btn:hover,
    button:hover {
        filter: brightness(0.97);
    }

.btn-outline {
    background: #ffffff;
    color: var(--blue);
}

.btn-success {
    background: var(--green);
    border-color: var(--green);
}

.btn-danger {
    background: var(--red);
    border-color: var(--red);
}

.btn-muted {
    background: #ffffff;
    color: var(--text);
    border-color: #c8d2dc;
}

.btn[disabled],
button[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

/* =========================================================
   TABLE
   ========================================================= */

.table-wrap {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

th,
td {
    padding: 13px 14px;
    border-bottom: 1px solid #edf2f7;
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--blue);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #fbfdff;
}

tr:last-child td {
    border-bottom: none;
}

/* =========================================================
   BADGE / LOG / UTILITY
   ========================================================= */

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 900;
    border: 1px solid transparent;
}

    .badge.Active {
        background: #e9f8ee;
        color: var(--green);
        border-color: #c7ecd2;
    }

    .badge.Suspended {
        background: #fff4e8;
        color: var(--orange);
        border-color: #ffd9ab;
    }

    .badge.Revoked,
    .badge.Expired {
        background: #fdeeee;
        color: var(--red);
        border-color: #f7c8c8;
    }

.log-box,
pre.report {
    background: var(--dark);
    color: #50ff6e;
    border-radius: 16px;
    padding: 18px;
    overflow: auto;
    font-family: Consolas, monospace;
    font-size: 13px;
    line-height: 1.45;
}

.notice {
    border: 1px solid #cfe0f3;
    background: var(--light);
    color: var(--blue);
    border-radius: 16px;
    padding: 14px;
    font-weight: 700;
}

.validation-summary-errors,
.field-validation-error {
    color: var(--red);
    font-weight: 700;
}

.empty-state {
    text-align: center;
    padding: 30px;
    color: var(--muted);
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.mono {
    font-family: Consolas, monospace;
}

.small {
    font-size: 12px;
}

.muted {
    color: var(--muted);
}

/* =========================================================
   MOTIONLAB COMPACT GENERATION PAGE
   Questa sezione sostituisce il vecchio blocco .motionlab-*.
   Usa queste classi insieme al nuovo Generate.cshtml compatto.
   ========================================================= */

.motion-compact-page {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.motion-compact-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 14px;
    width: 100%;
    max-width: 100%;
    min-height: calc(100vh - 116px);
}

.motion-compact-panel {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(20, 35, 55, 0.04);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.motion-compact-brand {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 18px;
}

.motion-compact-logo-box {
    width: 68px;
    height: 68px;
    border-radius: 17px;
    background: #ffffff;
    border: 1px solid #d7e4f2;
    box-shadow: 0 10px 24px rgba(0, 92, 175, 0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.motion-compact-logo {
    max-width: 60px;
    max-height: 60px;
    object-fit: contain;
    display: block;
}

.motion-compact-brand-title {
    color: var(--blue);
    font-size: 23px;
    font-weight: 900;
    line-height: 1;
}

.motion-compact-brand-green {
    color: var(--green);
    font-size: 17px;
    font-weight: 900;
    line-height: 1.1;
    margin-top: 4px;
}

.motion-compact-brand-subtitle {
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    line-height: 1.2;
    margin-top: 6px;
    letter-spacing: 0.03em;
}

.motion-compact-section-title {
    color: var(--blue);
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.motion-compact-separator {
    height: 2px;
    background: var(--blue2);
    margin: 10px 0 18px;
}

.motion-compact-input-block {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 10px;
    margin-bottom: 22px;
}

.motion-compact-icon {
    width: 38px;
    height: 38px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
    font-weight: 900;
    margin-top: 6px;
}

.motion-compact-icon-blue {
    background: var(--blue);
}

.motion-compact-icon-green {
    background: var(--green);
}

.motion-compact-icon-purple {
    background: var(--purple);
}

.motion-compact-input-content label {
    display: block;
    font-size: 14px;
    font-weight: 900;
    color: var(--text);
    margin-bottom: 1px;
}

.motion-compact-input-content small {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
    margin-bottom: 7px;
}

.motion-compact-number-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

    .motion-compact-number-row span {
        white-space: nowrap;
        color: var(--text);
        font-size: 13px;
    }

.motion-compact-number,
.motion-compact-select {
    height: 38px;
    border: 1px solid #c8d2dc;
    border-radius: 9px;
    padding: 8px 10px;
    font-size: 14px;
    background: #ffffff;
    color: var(--text);
}

.motion-compact-number {
    width: 128px;
}

.motion-compact-select {
    width: 100%;
}

    .motion-compact-number:focus,
    .motion-compact-select:focus {
        outline: none;
        border-color: var(--blue2);
        box-shadow: 0 0 0 3px rgba(0, 122, 215, 0.12);
    }

.motion-compact-help {
    margin-top: auto;
    background: #f8fbff;
    border: 1px solid #dce8f3;
    border-radius: 14px;
    padding: 11px;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.42;
}

    .motion-compact-help strong {
        display: block;
        color: var(--blue);
        font-size: 12px;
        text-transform: uppercase;
        margin-bottom: 6px;
    }

    .motion-compact-help span {
        display: block;
    }

.motion-compact-main {
    min-width: 0;
    display: grid;
    grid-template-rows: auto auto minmax(230px, 1fr) auto;
    gap: 12px;
}

.motion-compact-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 15px 17px;
    box-shadow: 0 8px 24px rgba(20, 35, 55, 0.04);
    min-width: 0;
}

.motion-compact-patient-card {
    min-height: 82px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.motion-compact-kicker {
    color: var(--blue);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 5px;
}

.motion-compact-patient-name {
    color: var(--text);
    font-size: 23px;
    font-weight: 900;
    line-height: 1.1;
}

.motion-compact-patient-actions {
    flex-shrink: 0;
}

.motion-compact-card-title {
    color: var(--blue);
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
}

.motion-compact-angle-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(125px, 1fr));
    gap: 9px;
}

.motion-compact-angle-card {
    min-width: 0;
    min-height: 86px;
    border: 1px solid #cfe0f3;
    border-radius: 14px;
    background: #ffffff;
    padding: 10px;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 9px;
    align-items: center;
}

.motion-compact-angle-icon {
    width: 34px;
    height: 34px;
    background: #edf5ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 900;
}

    .motion-compact-angle-icon.blue {
        color: var(--blue2);
    }

    .motion-compact-angle-icon.green {
        color: var(--green);
    }

    .motion-compact-angle-icon.orange {
        color: var(--orange);
    }

    .motion-compact-angle-icon.purple {
        color: var(--purple);
    }

    .motion-compact-angle-icon.red {
        color: var(--red);
    }

.motion-compact-angle-title {
    font-size: 10.5px;
    font-weight: 900;
    margin-bottom: 4px;
    white-space: nowrap;
}

    .motion-compact-angle-title.blue {
        color: var(--blue);
    }

    .motion-compact-angle-title.green {
        color: var(--green);
    }

    .motion-compact-angle-title.orange {
        color: var(--orange);
    }

    .motion-compact-angle-title.purple {
        color: var(--purple);
    }

    .motion-compact-angle-title.red {
        color: var(--red);
    }

.motion-compact-angle-line {
    font-size: 14px;
    font-weight: 900;
    color: var(--blue);
    line-height: 1.23;
}

    .motion-compact-angle-line.green {
        color: #149445;
    }

.motion-compact-angle-card small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 10.5px;
}

.motion-compact-final {
    font-size: 24px;
    font-weight: 900;
    color: #000000;
    line-height: 1;
}

.motion-compact-log-card {
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.motion-compact-log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 8px;
}

.motion-compact-clear {
    min-width: 112px;
    height: 34px;
    padding: 7px 12px;
}

.motion-compact-log {
    flex: 1;
    min-height: 210px;
    max-height: 300px;
    background: var(--dark);
    color: #50ff6e;
    border-radius: 12px;
    padding: 14px;
    overflow: auto;
    font-family: Consolas, monospace;
    font-size: 12.2px;
    line-height: 1.4;
    margin: 0;
    white-space: pre;
}

.motion-compact-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 160px 200px;
    gap: 12px;
    align-items: center;
}

.motion-compact-footer-info {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 14px;
    min-height: 52px;
    display: flex;
    align-items: center;
    padding: 10px 14px;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.35;
}

.motion-compact-footer-button {
    height: 52px;
    font-size: 14.5px;
    font-weight: 900;
}

@media (max-width: 1550px) {
    .motion-compact-layout {
        grid-template-columns: 285px minmax(0, 1fr);
        gap: 12px;
    }

    .motion-compact-panel {
        padding: 14px;
    }

    .motion-compact-angle-grid {
        grid-template-columns: repeat(5, minmax(118px, 1fr));
        gap: 8px;
    }

    .motion-compact-angle-card {
        grid-template-columns: 30px minmax(0, 1fr);
        padding: 9px;
    }

    .motion-compact-angle-icon {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }

    .motion-compact-angle-line {
        font-size: 13px;
    }

    .motion-compact-final {
        font-size: 22px;
    }

    .motion-compact-log {
        max-height: 280px;
    }
}

@media (max-width: 1250px) {
    .motion-compact-layout {
        grid-template-columns: 1fr;
    }

    .motion-compact-panel {
        min-height: auto;
    }

    .motion-compact-help {
        margin-top: 10px;
    }

    .motion-compact-angle-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .motion-compact-footer {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

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

        .app-shell.login-page {
            display: flex !important;
        }

    .sidebar {
        display: none;
    }

    .grid,
    .grid-3 {
        grid-template-columns: 1fr 1fr;
    }

    .topbar {
        height: auto;
        padding: 16px;
        gap: 14px;
        flex-direction: column;
        align-items: flex-start;
    }

    .top-actions {
        flex-wrap: wrap;
    }

    .content {
        padding: 16px;
    }
}

@media (max-width: 700px) {
    .grid,
    .grid-2,
    .grid-3,
    .form-row,
    .form-row.three,
    .motion-compact-angle-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        display: block;
    }

    .login-card {
        width: 100%;
        padding: 26px;
    }

    .login-logo-box {
        width: 72px;
        height: 72px;
    }

    .login-logo {
        max-width: 64px;
        max-height: 64px;
    }

    .login-brand-title {
        font-size: 24px;
    }

    .login-brand-subtitle-main {
        font-size: 19px;
    }

    .motion-compact-patient-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .motion-compact-input-block {
        grid-template-columns: 42px minmax(0, 1fr);
    }
}


/* =========================================================
   RETRUSION WEB INTEGRATION
   ========================================================= */
.motion-compact-output-note {
    display: block;
    margin-top: 5px;
    font-size: 12px !important;
    line-height: 1.2;
    word-break: break-word;
}

.motion-compact-angle-card strong {
    word-break: break-word;
}

.motion-compact-angle-card .motion-compact-angle-line.green strong {
    font-size: 13px;
}

@media (max-width: 1500px) {
    .motion-compact-angle-card .motion-compact-angle-line.green strong {
        font-size: 12px;
    }
}

/* Language switch */
.language-pill.active {
    background: var(--blue, #005caf);
    color: #fff;
    border-color: var(--blue, #005caf);
}

.login-language-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 0 0 18px 0;
}
/* =========================================================
   WILSON CURVE MODULE
   ========================================================= */

.wilson-page {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.wilson-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 14px;
    width: 100%;
    max-width: 100%;
    min-height: calc(100vh - 116px);
}

.wilson-panel {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(20, 35, 55, 0.04);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.wilson-main {
    min-width: 0;
    display: grid;
    grid-template-rows: auto auto minmax(260px, 1fr) auto;
    gap: 12px;
}

.wilson-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 15px 17px;
    box-shadow: 0 8px 24px rgba(20, 35, 55, 0.04);
    min-width: 0;
}

.wilson-card-title {
    color: var(--blue);
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
}

.wilson-preview {
    min-height: 260px;
    border: 1px dashed #bcd3ea;
    border-radius: 16px;
    background: linear-gradient(135deg, #ffffff, #f3f9ff);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-weight: 800;
}

.wilson-input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.wilson-coeff-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.wilson-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 170px 190px;
    gap: 12px;
    align-items: center;
}

.wilson-footer-info {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 14px;
    min-height: 52px;
    display: flex;
    align-items: center;
    padding: 10px 14px;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.35;
}

.wilson-radius-value {
    font-weight: 900;
    color: var(--blue);
}

@media (max-width: 1250px) {
    .wilson-layout {
        grid-template-columns: 1fr;
    }

    .wilson-footer {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .wilson-input-grid,
    .wilson-coeff-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   WILSON 3D PREVIEW
   ========================================================= */

.wilson-preview-3d {
    position: relative;
    border: 1px dashed #bcd3ea;
    border-radius: 16px;
    background: linear-gradient(135deg, #ffffff, #f3f9ff);
    overflow: hidden;
    min-height: 430px;
}

    .wilson-preview-3d canvas {
        display: block;
        width: 100%;
        height: 430px;
        cursor: grab;
    }

        .wilson-preview-3d canvas:active {
            cursor: grabbing;
        }

.wilson-preview-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.wilson-preview-legend {
    position: absolute;
    top: 12px;
    right: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid #d8e6f4;
    border-radius: 12px;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 800;
    color: #24364b;
    box-shadow: 0 8px 18px rgba(20, 35, 55, 0.08);
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    margin-right: 6px;
    vertical-align: middle;
}

.legend-spee {
    background: #8fbce8;
}

.legend-wilson-left {
    background: #005caf;
}

.legend-wilson-right {
    background: #149445;
}

.wilson-preview-hint {
    position: absolute;
    left: 14px;
    bottom: 12px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid #d8e6f4;
    border-radius: 12px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 700;
    color: #5c6b7a;
}

.btn-sm {
    padding: 7px 11px;
    font-size: 12px;
    border-radius: 10px;
}

/* =========================================================
   MOBILE RESPONSIVE FIX - SIDEBAR
   ========================================================= */

.mobile-topbar {
    display: none;
}

.sidebar-overlay {
    display: none;
}

@media (max-width: 900px) {

    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .app-shell {
        display: block !important;
        min-height: 100vh;
    }

    .mobile-topbar {
        position: sticky;
        top: 0;
        left: 0;
        right: 0;
        z-index: 3000;
        display: flex !important;
        align-items: center;
        gap: 12px;
        min-height: 56px;
        padding: 10px 14px;
        background: #0f172a;
        color: #ffffff;
        box-shadow: 0 2px 12px rgba(15, 23, 42, 0.25);
    }

    .mobile-menu-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        border: 0;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.14);
        color: #ffffff;
        font-size: 25px;
        line-height: 1;
        cursor: pointer;
    }

    .mobile-brand {
        font-size: 16px;
        font-weight: 700;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .app-shell .sidebar,
    #appSidebar {
        display: flex !important;
        flex-direction: column !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        z-index: 5000 !important;
        width: 285px !important;
        max-width: 86vw !important;
        height: 100vh !important;
        min-height: 100vh !important;
        overflow-y: auto !important;
        background: #0f172a !important;
        color: #ffffff !important;
        transform: translateX(-110%) !important;
        transition: transform 0.22s ease-in-out !important;
        box-shadow: 12px 0 32px rgba(0, 0, 0, 0.35) !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

        .app-shell .sidebar.sidebar-open,
        #appSidebar.sidebar-open {
            transform: translateX(0) !important;
        }

    .sidebar-overlay {
        position: fixed !important;
        inset: 0 !important;
        z-index: 4000 !important;
        display: none;
        background: rgba(15, 23, 42, 0.55);
    }

        .sidebar-overlay.sidebar-overlay-visible {
            display: block !important;
        }

    body.sidebar-mobile-open {
        overflow: hidden !important;
    }

    .main-area {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .topbar {
        display: none !important;
    }

    .content {
        width: 100% !important;
        max-width: 100% !important;
        padding: 16px !important;
        margin: 0 !important;
    }

    .page-header {
        display: block !important;
    }

    .page-title {
        font-size: 25px !important;
        line-height: 1.2 !important;
    }

    .page-subtitle {
        font-size: 14px !important;
    }

    .actions,
    .page-header .actions {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        width: 100% !important;
        margin-top: 16px !important;
    }

        .actions .btn,
        .page-header .actions .btn {
            width: 100% !important;
            justify-content: center !important;
            text-align: center !important;
        }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr !important;
    }

    .card {
        padding: 16px !important;
        border-radius: 16px !important;
    }

    .table-wrap {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

        .table-wrap table {
            min-width: 760px !important;
        }

    input,
    select,
    textarea {
        max-width: 100% !important;
    }
}

@media (max-width: 520px) {
    .content {
        padding: 12px !important;
    }

    .card {
        padding: 14px !important;
    }

    .btn {
        min-height: 42px;
    }
}

/* =========================================================
   SIDEBAR COLORS FIX - DESKTOP + MOBILE
   ========================================================= */

.sidebar {
    background: #111827 !important;
    color: #f9fafb !important;
}

    .sidebar .brand-title,
    .sidebar .brand-subtitle-main,
    .sidebar .brand-subtitle,
    .sidebar .sidebar-footer,
    .sidebar .sidebar-footer small,
    .sidebar .mini-logo {
        color: #f9fafb !important;
    }

    .sidebar .side-nav {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .sidebar .nav-link {
        color: #e5e7eb !important;
        background: transparent !important;
        border-radius: 12px;
        padding: 12px 14px;
        text-decoration: none !important;
        font-weight: 600;
        display: flex;
        align-items: center;
        gap: 10px;
    }

        .sidebar .nav-link span {
            color: #93c5fd !important;
            min-width: 22px;
            text-align: center;
        }

        .sidebar .nav-link:hover {
            color: #ffffff !important;
            background: rgba(59, 130, 246, 0.22) !important;
        }

            .sidebar .nav-link:hover span {
                color: #ffffff !important;
            }

        .sidebar .nav-link.active,
        .sidebar .nav-link:focus {
            color: #ffffff !important;
            background: rgba(37, 99, 235, 0.35) !important;
            outline: none;
        }

    .sidebar .brand {
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
        padding-bottom: 18px;
        margin-bottom: 18px;
    }

    .sidebar .sidebar-footer {
        border-top: 1px solid rgba(255, 255, 255, 0.12);
        margin-top: auto;
        padding-top: 18px;
    }

/* Fix specifico mobile */
@media (max-width: 900px) {
    #appSidebar,
    .app-shell .sidebar {
        background: #111827 !important;
        color: #f9fafb !important;
    }

        #appSidebar .nav-link,
        .app-shell .sidebar .nav-link {
            color: #e5e7eb !important;
            background: rgba(255, 255, 255, 0.04) !important;
        }

            #appSidebar .nav-link span,
            .app-shell .sidebar .nav-link span {
                color: #93c5fd !important;
            }

            #appSidebar .nav-link:hover,
            .app-shell .sidebar .nav-link:hover {
                color: #ffffff !important;
                background: rgba(59, 130, 246, 0.28) !important;
            }

        #appSidebar .brand-title,
        #appSidebar .brand-subtitle-main,
        #appSidebar .brand-subtitle,
        #appSidebar .sidebar-footer,
        #appSidebar .sidebar-footer small,
        #appSidebar .mini-logo {
            color: #f9fafb !important;
        }
}