/* ==========================================
   WSuite Mobile Web — Stili principali
   Prototipo dell'interfaccia app mobile
   ========================================== */

:root {
    /* Brand palette Wellcom */
    --app-primary: #0F332D;
    --app-primary-dark: #0a2420;
    --app-primary-light: #1a5248;
    --app-primary-container: #e8f0ef;
    --app-secondary: #4CAF50;
    --app-accent: #4CAF50;

    /* Surface */
    --app-bg: #F5F5F5;
    --app-surface: #FFFFFF;
    --app-surface-variant: #F0F4F3;
    --app-border: #E0E0E0;

    /* Text */
    --app-text: #1C1C1E;
    --app-text-secondary: #6B7280;
    --app-text-disabled: #BDBDBD;

    /* Status */
    --app-danger: #D32F2F;
    --app-danger-light: #ffebee;
    --app-success: #2E7D32;
    --app-success-light: #e8f5e9;
    --app-warning: #F57C00;
    --app-warning-light: #fff3e0;
    --app-info: #0288D1;

    /* Layout */
    --tab-bar-height: 56px;
    --header-height: 56px;
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: #1C1C1E;
    overflow: hidden;
}

/* Phone frame on desktop */
.phone-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.phone-frame {
    width: 390px;
    height: 844px;
    max-height: 100vh;
    background: var(--app-bg);
    border-radius: 44px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 0 0 10px #1C1C1E, 0 0 0 12px #3A3A3C, 0 40px 80px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
}

/* On actual mobile, go full screen */
@media (max-width: 430px) {
    .phone-container {
        padding: 0;
        background: var(--app-bg);
    }
    .phone-frame {
        width: 100%;
        height: 100vh;
        border-radius: 0;
        box-shadow: none;
    }
}

/* ---- App Header ---- */
.app-header {
    height: var(--header-height);
    background: var(--app-primary);
    color: white;
    display: flex;
    align-items: center;
    padding: 0 16px;
    flex-shrink: 0;
    position: relative;
}

.app-header h1 {
    font-size: 17px;
    font-weight: 600;
    text-align: center;
    flex: 1;
    letter-spacing: -0.3px;
}

.app-header .header-back {
    position: absolute;
    left: 16px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 15px;
    color: white;
    cursor: pointer;
    text-decoration: none;
}

.app-header .header-action {
    position: absolute;
    right: 16px;
    font-size: 22px;
    cursor: pointer;
}

/* ---- Page Content ---- */
.app-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    padding-bottom: calc(var(--tab-bar-height) + 8px);
    -webkit-overflow-scrolling: touch;
}

/* ---- Bottom Tab Bar ---- */
.tab-bar {
    height: var(--tab-bar-height);
    background: var(--app-surface);
    border-top: 1px solid var(--app-border);
    display: flex;
    align-items: stretch;
    flex-shrink: 0;
    padding-bottom: var(--safe-area-bottom);
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    text-decoration: none;
    color: var(--app-text-secondary);
    font-size: 10px;
    font-weight: 500;
    transition: color 0.15s;
    border: none;
    background: none;
    padding: 6px 2px;
    -webkit-tap-highlight-color: transparent;
}

.tab-item.active {
    color: var(--app-primary);
}

.tab-item .tab-icon {
    font-size: 20px;
    line-height: 1;
}

.tab-item .tab-label {
    font-size: 10px;
    font-weight: 500;
}

/* ---- Cards ---- */
.app-card {
    background: var(--app-surface);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.app-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--app-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

/* ---- Stat cards ---- */
.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.stat-card {
    background: var(--app-surface);
    border-radius: 12px;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.stat-card .stat-icon {
    font-size: 24px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--app-text);
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--app-text-secondary);
}

/* ---- List items ---- */
.list-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--app-border);
    gap: 12px;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.list-item-icon.blue { background: var(--app-primary-container); }
.list-item-icon.green { background: var(--app-success-light); }
.list-item-icon.orange { background: var(--app-warning-light); }
.list-item-icon.red { background: var(--app-danger-light); }
.list-item-icon.purple { background: #FAF5FF; }

.list-item-body {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--app-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-subtitle {
    font-size: 13px;
    color: var(--app-text-secondary);
    margin-top: 2px;
}

.list-item-right {
    font-size: 13px;
    color: var(--app-text-secondary);
    flex-shrink: 0;
}

/* ---- Badge ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge-blue { background: var(--app-primary-container); color: var(--app-primary); }
.badge-green { background: var(--app-success-light); color: var(--app-success); }
.badge-red { background: var(--app-danger-light); color: var(--app-danger); }
.badge-orange { background: var(--app-warning-light); color: var(--app-warning); }
.badge-gray { background: #F3F4F6; color: #6B7280; }

/* ---- Buttons ---- */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--app-primary);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: background 0.15s;
}

.btn-primary:active { background: var(--app-primary-dark); }

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--app-primary);
    border: 1.5px solid var(--app-primary);
    border-radius: 10px;
    padding: 11px 20px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
}

/* ---- Section header ---- */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.section-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--app-text);
}

.section-action {
    font-size: 14px;
    color: var(--app-primary);
    cursor: pointer;
    text-decoration: none;
}

/* ---- Greeting ---- */
.greeting {
    margin-bottom: 20px;
}

.greeting-sub {
    font-size: 14px;
    color: var(--app-text-secondary);
    margin-top: 4px;
}

.greeting-name {
    font-size: 24px;
    font-weight: 700;
    color: var(--app-text);
}

/* ---- Role selector (login screen) ---- */
.role-selector {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    padding: 32px 24px;
    background: var(--app-surface);
}

.role-selector-logo {
    text-align: center;
    margin-bottom: 40px;
}

.role-selector-logo .logo-text {
    font-size: 36px;
    font-weight: 800;
    color: var(--app-primary);
}

.role-selector-logo .logo-sub {
    font-size: 16px;
    color: var(--app-text-secondary);
    margin-top: 4px;
}

.role-selector h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--app-text);
    margin-bottom: 8px;
}

.role-selector p {
    font-size: 14px;
    color: var(--app-text-secondary);
    margin-bottom: 24px;
}

.role-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border: 1.5px solid var(--app-border);
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--app-surface);
    text-align: left;
    width: 100%;
    text-decoration: none;
}

.role-option:hover, .role-option:active {
    border-color: var(--app-primary);
    background: var(--app-primary-container);
}

.role-option .role-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.role-option .role-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--app-text);
}

.role-option .role-desc {
    font-size: 13px;
    color: var(--app-text-secondary);
}

/* ---- Profilo ---- */
.profilo-header {
    text-align: center;
    padding: 24px 16px 16px;
}

.profilo-avatar {
    width: 80px;
    height: 80px;
    border-radius: 40px;
    background: var(--app-primary);
    color: white;
    font-size: 32px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.profilo-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--app-text);
}

.profilo-role {
    font-size: 14px;
    color: var(--app-text-secondary);
    margin-top: 4px;
}

/* ---- Alert card ---- */
.alert-card {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: 12px;
    padding: 14px;
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.alert-card.warning {
    background: #FFFBEB;
    border-color: #FDE68A;
}

.alert-card .alert-icon { font-size: 20px; flex-shrink: 0; }
.alert-card .alert-text { font-size: 14px; color: var(--app-text); }
.alert-card .alert-title { font-size: 14px; font-weight: 600; margin-bottom: 2px; }

/* ---- Turno card ---- */
.turno-card {
    background: var(--app-surface);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex;
    gap: 12px;
    align-items: center;
}

.turno-time {
    text-align: center;
    min-width: 56px;
}

.turno-time .time-label {
    font-size: 18px;
    font-weight: 700;
    color: var(--app-primary);
    line-height: 1;
}

.turno-time .date-label {
    font-size: 11px;
    color: var(--app-text-secondary);
    margin-top: 2px;
}

.turno-body { flex: 1; }
.turno-location { font-size: 15px; font-weight: 600; color: var(--app-text); }
.turno-role { font-size: 13px; color: var(--app-text-secondary); }

/* SOS button */
.sos-button {
    width: 160px;
    height: 160px;
    border-radius: 80px;
    background: var(--app-danger);
    border: none;
    cursor: pointer;
    color: white;
    font-size: 18px;
    font-weight: 700;
    box-shadow: 0 0 0 16px rgba(220,38,38,0.1), 0 0 0 32px rgba(220,38,38,0.05);
    margin: 20px auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.sos-button .sos-icon { font-size: 48px; display: block; text-align: center; }
.sos-button .sos-label { font-size: 16px; font-weight: 700; }

/* Scrollbar hide */
.app-content::-webkit-scrollbar { display: none; }
.app-content { -ms-overflow-style: none; scrollbar-width: none; }

/* ---- Alert card varianti brand ---- */
.alert-card.info {
    background: var(--app-primary-container);
    border-color: #b2d8d4;
}

/* ---- Health Score ---- */
.health-score-card {
    background: var(--app-primary);
    border-radius: 16px;
    padding: 20px;
    color: white;
    margin-bottom: 12px;
    text-align: center;
}

.health-score-number {
    font-size: 64px;
    font-weight: 800;
    line-height: 1;
}

.health-score-label {
    font-size: 13px;
    opacity: 0.8;
    margin-top: 4px;
}

.health-score-sub {
    font-size: 12px;
    opacity: 0.65;
    margin-top: 8px;
}

.health-score-card.ok    { background: var(--app-warning); }
.health-score-card.alert { background: var(--app-danger); }

/* ---- Primary card (tinted) ---- */
.app-card-primary {
    background: var(--app-primary-container);
    border: 1px solid #b2d8d4;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

/* ---- Quick action grid ---- */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 4px;
    background: var(--app-surface);
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    color: var(--app-text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: none;
    font-size: inherit;
}

.quick-action .qa-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--app-primary-container);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.quick-action .qa-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--app-text-secondary);
    text-align: center;
}

/* ---- Chip filtri ---- */
.filter-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 14px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display: none; }

.chip {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1.5px solid var(--app-border);
    background: var(--app-surface);
    color: var(--app-text-secondary);
    white-space: nowrap;
}

.chip.active {
    background: var(--app-primary);
    border-color: var(--app-primary);
    color: white;
}

/* ---- Service card ---- */
.service-card {
    background: var(--app-surface);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.service-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--app-primary-container);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.service-info { flex: 1; min-width: 0; }
.service-name { font-size: 15px; font-weight: 600; color: var(--app-text); }
.service-detail { font-size: 12px; color: var(--app-text-secondary); margin-top: 2px; }
.service-price { font-size: 14px; font-weight: 700; color: var(--app-primary); }

/* ---- Priority chips ---- */
.priority-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.priority-alta   { background: var(--app-danger-light); color: var(--app-danger); }
.priority-media  { background: var(--app-warning-light); color: var(--app-warning); }
.priority-bassa  { background: var(--app-success-light); color: var(--app-success); }

/* ---- Material Icons ---- */
.material-icons {
    font-size: 22px;
    line-height: 1;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tab-icon .material-icons { font-size: 20px; }
.stat-icon .material-icons { font-size: 28px; }
.list-item-icon .material-icons { font-size: 20px; }
.header-action .material-icons { font-size: 22px; }
.sos-icon .material-icons { font-size: 48px; }
.role-icon .material-icons { font-size: 36px; }

/* ---- MudIcon sizing in custom components ---- */
.tab-icon .mud-icon-root { font-size: 20px !important; }
.stat-icon .mud-icon-root { font-size: 28px !important; }
.list-item-icon .mud-icon-root { font-size: 20px !important; }
.header-action .mud-icon-root { font-size: 22px !important; }
.sos-icon .mud-icon-root { font-size: 48px !important; }
.role-icon .mud-icon-root { font-size: 32px !important; }

/* =========================================================
   Dashboard: health score card (nuovo layout orizzontale)
   ========================================================= */
.health-score-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.score-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
    font-size: 22px;
    font-weight: 800;
}

/* =========================================================
   Vitali 2x2 grid
   ========================================================= */
.vitali-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.vitale-card {
    background: #fff;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,.07);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.vitale-valore {
    font-size: 20px;
    font-weight: 700;
    color: var(--app-text-primary);
    line-height: 1;
}

.vitale-unita {
    font-size: 12px;
    font-weight: 400;
    color: var(--app-text-secondary);
}

.vitale-label {
    font-size: 11px;
    color: var(--app-text-secondary);
}

/* =========================================================
   Programma / Attività
   ========================================================= */
.attivita-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
}

.attivita-border {
    border-bottom: 1px solid #F3F4F6;
}

.attivita-ora {
    font-size: 11px;
    font-weight: 600;
    color: var(--app-text-secondary);
    width: 38px;
    flex-shrink: 0;
}

.attivita-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.attivita-titolo {
    font-size: 13px;
    font-weight: 600;
    color: var(--app-text-primary);
}

.attivita-luogo {
    font-size: 11px;
    color: var(--app-text-secondary);
    margin-top: 1px;
}

/* =========================================================
   Quick action items (link-card con icona colorata)
   ========================================================= */
.quick-action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--app-text-primary);
    font-size: 11px;
    font-weight: 600;
}

.quick-action-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================================================
   SOS button in header
   ========================================================= */
.sos-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #E53935;
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.5px;
}

/* =========================================================
   SOS overlay + modal
   ========================================================= */
.sos-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 9999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.sos-modal {
    background: #C62828;
    border-radius: 20px 20px 0 0;
    padding: 28px 24px 32px;
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    animation: slideUp .25s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.sos-modal-icon { margin-bottom: 4px; }

.sos-modal-title {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 1px;
}

.sos-modal-text {
    font-size: 14px;
    color: rgba(255,255,255,0.85);
    text-align: center;
    line-height: 1.5;
}

.sos-countdown {
    font-size: 56px;
    font-weight: 800;
    color: #fff;
    line-height: 1;
    margin-bottom: 4px;
}

.sos-confirm-btn {
    width: 100%;
    background: #fff;
    color: #C62828;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.sos-cancel-btn {
    width: 100%;
    background: transparent;
    color: #fff;
    border: 2px solid rgba(255,255,255,0.6);
    border-radius: 12px;
    padding: 12px;
    font-size: 15px;
    cursor: pointer;
}

.sos-inviato {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
}

/* =========================================================
   Servizi — filtri chip
   ========================================================= */
.servizi-filtri {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 14px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.servizi-filtri::-webkit-scrollbar { display: none; }

.servizi-chip {
    flex-shrink: 0;
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1.5px solid var(--app-border);
    background: var(--app-surface);
    color: var(--app-text-secondary);
    white-space: nowrap;
}
.servizi-chip.active {
    background: var(--app-primary);
    border-color: var(--app-primary);
    color: #fff;
}

/* =========================================================
   Servizi — card
   ========================================================= */
.servizio-card {
    background: var(--app-surface);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    transition: box-shadow .2s;
}
.servizio-card.expanded {
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}

.servizio-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.servizio-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.servizio-info { flex: 1; min-width: 0; }
.servizio-nome {
    font-size: 15px;
    font-weight: 600;
    color: var(--app-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.servizio-categoria {
    font-size: 11px;
    font-weight: 600;
    color: var(--app-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 1px;
}
.servizio-disponibilita {
    font-size: 11px;
    color: var(--app-text-secondary);
    margin-top: 4px;
    display: flex;
    align-items: center;
}

.servizio-destra {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.servizio-prezzo {
    font-size: 14px;
    font-weight: 700;
    color: var(--app-primary);
}
.servizio-prezzo.incluso {
    color: var(--app-success);
    font-size: 12px;
    background: var(--app-success-light);
    padding: 2px 8px;
    border-radius: 10px;
}

.servizio-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 10px;
}
.servizio-badge.completato {
    background: #E3F2FD;
    color: #1565C0;
}

.servizio-btn {
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 10px;
    border: none;
    background: var(--app-primary);
    color: #fff;
    cursor: pointer;
    white-space: nowrap;
}
.servizio-btn.prenotato {
    background: #E8F5E9;
    color: var(--app-primary);
    border: 1px solid #b2d8b2;
}

/* =========================================================
   Servizi — pannello dettaglio espanso
   ========================================================= */
.servizio-dettaglio {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--app-border);
    animation: fadeIn .2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dettaglio-prenotato {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    background: var(--app-success-light);
    border-radius: 10px;
    margin-bottom: 10px;
}
.dettaglio-label { font-size: 11px; color: var(--app-text-secondary); }
.dettaglio-data  { font-size: 14px; font-weight: 700; color: var(--app-text); margin-top: 2px; }

.servizio-annulla-btn {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--app-danger);
    background: var(--app-danger-light);
    color: var(--app-danger);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dettaglio-form { display: flex; flex-direction: column; gap: 10px; }
.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--app-text-secondary); }
.form-input {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--app-border);
    font-size: 14px;
    color: var(--app-text);
    background: var(--app-surface-variant);
    width: 100%;
    box-sizing: border-box;
}
.form-input:focus { outline: none; border-color: var(--app-primary); }

.servizio-prenota-btn {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: none;
    background: var(--app-primary);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.servizio-prenota-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dettaglio-ok {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--app-success-light);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--app-success);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 40px 0;
    color: var(--app-text-secondary);
    font-size: 14px;
}

/* =========================================================
   Messaggi — lista conversazioni
   ========================================================= */
.msg-conv-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.msg-conv-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px;
    background: var(--app-surface);
    border-radius: 12px;
    cursor: pointer;
    transition: background .15s;
    margin-bottom: 6px;
}
.msg-conv-item:active { background: var(--app-surface-variant); }

.msg-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.msg-conv-info { flex: 1; min-width: 0; }

.msg-conv-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 3px;
}
.msg-conv-nome {
    font-size: 14px;
    font-weight: 600;
    color: var(--app-text);
}
.msg-conv-data {
    font-size: 11px;
    color: var(--app-text-secondary);
    flex-shrink: 0;
    margin-left: 8px;
}

.msg-conv-preview-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.msg-conv-preview {
    font-size: 12px;
    color: var(--app-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}
.msg-conv-preview.unread {
    color: var(--app-text);
    font-weight: 600;
}

.msg-badge {
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: var(--app-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    flex-shrink: 0;
}

/* =========================================================
   Messaggi — thread header
   ========================================================= */
.msg-thread-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0 14px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--app-border);
}

.msg-back-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--app-text-secondary);
    display: flex;
    align-items: center;
}

.msg-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.msg-thread-nome {
    font-size: 15px;
    font-weight: 600;
    color: var(--app-text);
}

/* =========================================================
   Messaggi — bolle chat
   ========================================================= */
.msg-bubble-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 8px 0;
    min-height: calc(100dvh - 280px);
    overflow-y: auto;
}

.msg-bubble-wrap {
    display: flex;
}
.msg-bubble-wrap.da-me    { justify-content: flex-end; }
.msg-bubble-wrap.da-altri { justify-content: flex-start; }

.msg-bubble {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
}

.bubble-me {
    background: var(--app-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.bubble-altri {
    background: var(--app-surface);
    color: var(--app-text);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.bubble-testo { margin-bottom: 3px; }
.bubble-ora {
    font-size: 10px;
    opacity: 0.65;
    text-align: right;
}

/* =========================================================
   Messaggi — input bar
   ========================================================= */
.msg-input-bar {
    position: fixed;
    bottom: 64px; /* sopra la tab bar */
    left: 0;
    right: 0;
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--app-surface);
    border-top: 1px solid var(--app-border);
    box-shadow: 0 -2px 8px rgba(0,0,0,.06);
}

.msg-input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 22px;
    border: 1.5px solid var(--app-border);
    font-size: 14px;
    background: var(--app-surface-variant);
    color: var(--app-text);
    outline: none;
}
.msg-input:focus { border-color: var(--app-primary); }

.msg-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--app-primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity .15s;
}
.msg-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

