/* ── Layout generale ───────────────────────────────────── */
body {
    background: #f4f6f9;
}

.app-wrapper {
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    min-height: 100vh;
    background: #1e2532;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar .nav-link {
    border-radius: .5rem;
}

.sidebar .nav-link:hover {
    background: rgba(255, 255, 255, .08);
}

.sidebar .nav-link.active {
    background: #0d6efd;
}

.main-content {
    min-width: 0;
}

.quick-search {
    width: 260px;
}

/* Sidebar responsive */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        z-index: 1050;
        left: -260px;
        transition: left .25s ease;
    }
    .sidebar.open {
        left: 0;
    }
}

/* ── Dashboard ─────────────────────────────────────────── */
.stat-card {
    transition: transform .12s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

/* ── Lista ticket ──────────────────────────────────────── */
.clickable-row {
    cursor: pointer;
}

/* ── Conversazione ticket ──────────────────────────────── */
.conversation {
    max-height: 60vh;
    overflow-y: auto;
}

.message {
    border-radius: .75rem;
    padding: .75rem 1rem;
    margin-bottom: .75rem;
    border: 1px solid #e5e8ee;
}

.message-client {
    background: #fff;
    margin-right: 2rem;
}

.message-staff {
    background: #eaf2ff;
    border-color: #cfe0fb;
    margin-left: 2rem;
}

.message-highlight {
    border-color: #f0ad4e;
    box-shadow: 0 0 0 3px rgba(240, 173, 78, .2);
}

.message-meta {
    font-size: .85rem;
    margin-bottom: .35rem;
}

.message-body {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    font-size: .92rem;
}

.message-body a {
    word-break: break-all;
}

/* ── Risposte preimpostate ─────────────────────────────── */
.predef-list {
    max-height: 320px;
    overflow-y: auto;
}

.predef-cat-header {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6c757d;
    margin: .6rem 0 .3rem;
    padding-bottom: .15rem;
    border-bottom: 1px solid #e5e8ee;
}

.predef-cat-header:first-child {
    margin-top: 0;
}

.predef-item {
    display: block;
    width: 100%;
    text-align: left;
    border: 1px solid #e5e8ee;
    border-radius: .5rem;
    background: #fff;
    padding: .5rem .75rem;
    margin-bottom: .4rem;
    font-size: .9rem;
    transition: background .1s ease;
}

.predef-item:hover {
    background: #eaf2ff;
    border-color: #0d6efd;
}

.predef-item .predef-preview {
    font-size: .78rem;
    color: #6c757d;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Prodotti cliente ──────────────────────────────────── */
.product-list {
    max-height: 300px;
    overflow-y: auto;
}

.product-item {
    display: flex;
    width: 100%;
    border: 1px solid #e5e8ee;
    border-radius: .5rem;
    background: #fff;
    padding: .5rem .75rem;
    margin-bottom: .4rem;
    cursor: pointer;
    transition: background .1s ease;
}

.product-item:hover {
    background: #f6f9ff;
}

.product-item:has(input:checked) {
    background: #eaf2ff;
    border-color: #0d6efd;
}

/* ── Editor ────────────────────────────────────────────── */
.reply-preview {
    background: #fdfdfd;
    overflow-y: auto;
    white-space: normal;
    word-wrap: break-word;
}

/* ── Login ─────────────────────────────────────────────── */
.login-page {
    background: linear-gradient(135deg, #1e2532 0%, #2a3a5c 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    border: 0;
    border-radius: 1rem;
}
