body, html {
    margin: 0;
    padding: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: #070816;
    color: #f3f4ff;
}

* {
    box-sizing: border-box;
}

a {
    text-decoration: none;
    color: inherit;
}

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top, #121B4A 0%, #070816 45%);
    padding: 8px;
}

.login-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    padding: 4px;
}

.login-logo-box {
    margin-bottom: 24px;
}

    .login-logo-box h1 {
        margin: 16px 0 8px;
        font-size: 48px;
        font-weight: 700;
    }

    .login-logo-box p {
        margin: 0;
        color: #9fa6d0;
        font-size: 18px;
    }

.login-logo-img {
    max-width: 320px;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto 18px;
}

.logo-icon {
    width: 74px;
    height: 74px;
    margin: 0 auto;
    background: linear-gradient(135deg, #0D1236, #1B2A6B);
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    box-shadow: 0 0 24px rgba(13, 18, 54, .35);
}

.card {
    background: #171a28;
    border: 1px solid #262a3f;
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 24px;
}

.login-card {
    width: 480px;
    max-width: 480px;
    min-width: 480px;
    margin: 0 auto;
    text-align: left;
    padding: 14px;
}

.login-card-wide {
    width: 480px !important;
    max-width: 480px !important;
    min-width: 480px !important;
    margin: 0 auto !important;
    padding: 14px !important;
}

.login-card .form-group {
    width: 100%;
}

.login-card .input-dark,
.login-card .select-dark,
.login-card .btn-primary {
    width: 100%;
    display: block;
}

.form-group {
    margin-bottom: 18px;
}

    .form-group label {
        display: block;
        margin-bottom: 8px;
        color: #aeb4da;
        font-size: 15px;
    }

.input-dark,
.select-dark {
    width: 100%;
    background: #0c1020;
    border: 1px solid #2c3150;
    border-radius: 16px;
    color: #ffffff;
    padding: 16px 18px;
    font-size: 17px;
    outline: none;
}

    .input-dark:focus,
    .select-dark:focus {
        border-color: #0D1236;
        box-shadow: 0 0 0 3px rgba(13, 18, 54, 0.22);
    }

.textarea-dark {
    min-height: 160px;
    resize: vertical;
}

.btn-primary,
.btn-secondary,
.btn-link-grid,
.btn-link-inline {
    display: inline-block;
    border: none;
    border-radius: 16px;
    padding: 14px 22px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary {
    background: linear-gradient(90deg, #6ABC45, #7ED957);
    color: #fff;
}

    .btn-primary:hover {
        filter: brightness(1.05);
    }

.btn-secondary {
    background: #1A214D;
    color: #fff;
}

    .btn-secondary:hover {
        filter: brightness(1.05);
    }

.btn-link-grid,
.btn-link-inline {
    background: transparent;
    color: #6ABC45;
    padding: 0;
}

.w-100 {
    width: 100%;
}

.text-error,
.validation-summary-errors {
    color: #ff7979;
    display: block;
    margin: 10px 0 14px;
}

.text-success {
    color: #76dd9f;
    display: block;
    margin: 10px 0 14px;
}

.footer-login {
    color: #8790ba;
    margin-top: 14px;
    font-size: 14px;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 270px;
    background: #0e1120;
    border-right: 1px solid #1f253d;
    padding: 14px 12px 18px;
    display: flex;
    flex-direction: column;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    padding: 8px 6px 20px;
}

    .brand .logo-icon {
        width: 42px;
        height: 42px;
        margin: 0;
        border-radius: 12px;
        font-size: 18px;
    }

.brand-logo-only {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo-img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    display: block;
}

.menu-title {
    padding: 0 8px;
    margin: 8px 0 12px;
    font-size: 12px;
    color: #6f769d;
    letter-spacing: 1px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    padding: 14px 14px;
    border-radius: 16px;
    color: #c8cdef;
    transition: .15s ease;
}

    .nav-item:hover,
    .nav-item.active {
        background: #1A214D;
        color: #ffffff;
    }

.sidebar-bottom {
    margin-top: auto;
    padding-top: 20px;
}

.main-area {
    flex: 1;
    min-width: 0;
}

.topbar {
    height: 72px;
    border-bottom: 1px solid #1f253d;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    background: #0b0e1c;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
}

.user-box {
    color: #dfe3ff;
    background: #1A214D;
    border: 1px solid #303552;
    border-radius: 24px;
    padding: 10px 16px;
}

.page-content {
    padding: 28px;
}

.page-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 22px;
}

    .page-header-flex h1 {
        margin: 0 0 8px;
        font-size: 28px;
    }

    .page-header-flex p {
        margin: 0;
        color: #99a0c8;
    }

.form-row,
.filters-row {
    display: flex;
    gap: 16px;
    margin-bottom: 18px;
}

    .form-row .form-group {
        flex: 1;
    }

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 12px;
}

.filter-grid-admin {
    display: grid;
    grid-template-columns: minmax(260px, 2fr) minmax(180px, 1fr) minmax(180px, 1fr) auto;
    gap: 16px;
    align-items: end;
    margin-bottom: 18px;
}

    .filter-grid-admin .input-dark,
    .filter-grid-admin .select-dark {
        width: 100%;
    }

    .filter-grid-admin .btn-secondary,
    .filter-grid-admin .btn-primary,
    .filter-grid-admin .btn-ordini,
    .filter-grid-admin .btn-offerte {
        min-width: 120px;
        width: auto;
        justify-self: start;
    }

.grid-dark {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
}

    .grid-dark th,
    .grid-dark td {
        padding: 14px 12px;
        border-bottom: 1px solid #262a3f;
        text-align: left;
        vertical-align: middle;
    }

    .grid-dark th {
        color: #b2b8db;
        font-weight: 600;
    }

    .grid-dark tr:hover td {
        background: rgba(255,255,255,.02);
    }

.empty-box {
    padding: 64px 24px;
    text-align: center;
    color: #9399bf;
}

.ticket-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ticket-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #101322;
    border: 1px solid #262a3d;
}

.ticket-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    color: #bbc1e4;
    margin-top: 10px;
}

.ticket-badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    background: #1A214D;
    color: #d8dcff;
    font-size: 13px;
}

.message-bubble {
    margin-bottom: 16px;
    padding: 15px 16px;
    border-radius: 18px;
    max-width: 78%;
    line-height: 1.5;
    word-break: break-word;
}

    .message-bubble.me {
        background: #0D1236;
        margin-left: auto;
    }

    .message-bubble.admin {
        background: #21263a;
        margin-right: auto;
    }

.message-header {
    font-size: 12px;
    opacity: .85;
    margin-bottom: 8px;
}

.message-body {
    line-height: 1.55;
}

.info-inline {
    color: #9ba4d4;
    font-size: 14px;
}

.login-input-clean {
    width: 100% !important;
    display: block !important;
    box-sizing: border-box !important;
    padding: 14px 16px !important;
    font-size: 14px !important;
    line-height: 1.2 !important;
    letter-spacing: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: clip !important;
}

    .login-input-clean::placeholder {
        font-size: 14px !important;
    }

    .login-input-clean::-ms-clear,
    .login-input-clean::-ms-reveal {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }

    .login-input-clean::-webkit-credentials-auto-fill-button,
    .login-input-clean::-webkit-contacts-auto-fill-button,
    .login-input-clean::-webkit-textfield-decoration-container {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

.profile-head {
    display: flex;
    align-items: center;
    gap: 18px;
}

.profile-avatar {
    width: 70px;
    height: 70px;
    border-radius: 999px;
    background: linear-gradient(135deg, #6f63ff, #4e7dff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
}

.profile-head-info h2 {
    margin: 0 0 6px;
}

.profile-email {
    color: #9fa6d0;
    margin-bottom: 8px;
}

.profile-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.header-actions-user {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-ordini,
.btn-offerte {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 165px;
    min-height: 50px;
    padding: 14px 22px;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    color: #fff !important;
    text-decoration: none !important;
    white-space: nowrap;
    box-sizing: border-box;
    text-align: center;
}

.header-actions-user .btn-primary,
.header-actions-user .btn-ordini,
.header-actions-user .btn-offerte {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 165px;
    min-height: 50px;
    padding: 14px 22px;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    color: #fff !important;
    text-decoration: none !important;
    white-space: nowrap;
    box-sizing: border-box;
    text-align: center;
}

.btn-ordini {
    background: linear-gradient(90deg, #1f7ae0, #3f95ff);
}

.btn-offerte {
    background: linear-gradient(90deg, #8a3ffc, #b06cff);
}

    .btn-ordini:hover,
    .btn-offerte:hover {
        filter: brightness(1.05);
    }

.ticket-badge.badge-stato-aperto {
    background: #1e2f78 !important;
    color: #8fb0ff !important;
}

.ticket-badge.badge-stato-lavorazione {
    background: #5a3a12 !important;
    color: #ffb347 !important;
}

.ticket-badge.badge-stato-consegna {
    background: #0f4b5a !important;
    color: #7fe7ff !important;
}

.ticket-badge.badge-stato-chiuso {
    background: #1c4a2a !important;
    color: #7ee08f !important;
}

.ticket-badge.badge-urgenza-bassa {
    background: #1c4a2a !important;
    color: #7ee08f !important;
}

.ticket-badge.badge-urgenza-media {
    background: #1e2f78 !important;
    color: #8fb0ff !important;
}

.ticket-badge.badge-urgenza-alta {
    background: #5a3a12 !important;
    color: #ffb347 !important;
}

.ticket-badge.badge-annullata {
    background: #4b1f28 !important;
    color: #ff9aa8 !important;
}

@media (max-width: 1500px) {
    .login-card,
    .login-card-wide {
        width: 1200px !important;
        max-width: 1200px !important;
        min-width: 1200px !important;
    }
}

@media (max-width: 1300px) {
    .login-card,
    .login-card-wide {
        width: 1100px !important;
        max-width: 1100px !important;
        min-width: 1100px !important;
    }
}

@media (max-width: 1100px) {
    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .form-row,
    .filters-row,
    .page-header-flex,
    .topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-grid-admin {
        grid-template-columns: 1fr;
    }

        .filter-grid-admin .btn-secondary,
        .filter-grid-admin .btn-primary,
        .filter-grid-admin .btn-ordini,
        .filter-grid-admin .btn-offerte {
            width: auto;
        }

    .message-bubble {
        max-width: 100%;
    }

    .login-wrapper {
        width: 100%;
        max-width: 100%;
        padding: 8px;
    }

    .login-card,
    .login-card-wide {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        padding: 14px !important;
    }

    .login-logo-img {
        max-width: 8400px;
        width: 100%;
        height: auto;
        display: block;
        margin: 0 auto 18px;
    }
    .consumabili-grid {
        width: 100%;
        border-collapse: separate;
        border-spacing: 0;
        margin-top: 10px;
        font-size: 15px;
        border: 1px solid #2b3354;
        border-radius: 12px;
        overflow: hidden;
        background: #11172b;
    }

        .consumabili-grid th,
        .consumabili-grid td {
            padding: 12px 14px;
            text-align: left;
            border-right: 1px solid #2b3354;
            border-bottom: 1px solid #2b3354;
        }

            .consumabili-grid th:last-child,
            .consumabili-grid td:last-child {
                border-right: none;
            }

        .consumabili-grid tr:last-child td {
            border-bottom: none;
        }

        .consumabili-grid th {
            color: #69BD44;
            font-weight: 700;
            background: rgba(105, 189, 68, 0.10);
            font-size: 15px;
        }

        .consumabili-grid td {
            color: #ffffff;
            background: transparent;
        }

        .consumabili-grid tr:hover td {
            background: rgba(255, 255, 255, 0.02);
        }
}
