/* ═══════════════════════════════════════════════════
   BRAVIN PROJECT — Stylesheet (Top Navigation)
   ═══════════════════════════════════════════════════ */

:root {
    --brand-primary: #4a90d9;
    --brand-dark: #2C3E50;
    --brand-light: #f8f9fa;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: #f0f2f5;
    line-height: 1.5;
}

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

/* ═══════════════════════════════════════════════════
   TOPBAR NAVIGATION
   ═══════════════════════════════════════════════════ */

.topbar {
    background: var(--brand-dark);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.topbar-left { flex-shrink: 0; margin-right: 1.5rem; }

.topbar-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}
.topbar-brand:hover { text-decoration: none; color: #fff; }

.topbar-logo { height: 40px; width: auto; }

/* ─── Nav Items ────────────────────────────────── */
.topbar-nav {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 0;
    overflow: visible;
}

.topnav-item {
    padding: 0 0.85rem;
    height: 56px;
    display: flex;
    align-items: center;
    color: rgba(255,255,255,0.75);
    font-size: 0.85rem;
    text-decoration: none;
    white-space: nowrap;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
    border-bottom: 2px solid transparent;
}

.topnav-item:hover {
    color: #fff;
    background: rgba(255,255,255,0.06);
    text-decoration: none;
}

.topnav-item.active {
    color: #fff;
    border-bottom-color: var(--brand-primary);
    background: rgba(255,255,255,0.08);
}

.caret { font-size: 0.6rem; margin-left: 0.3rem; opacity: 0.6; }

/* ─── Dropdown ─────────────────────────────────── */
.topnav-dropdown {
    position: relative;
}

.topnav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    min-width: 220px;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 110;
    padding: 0.35rem 0;
    border: 1px solid var(--border-color);
    border-top: 2px solid var(--brand-primary);
}

.topnav-dropdown:hover .topnav-menu,
.topnav-dropdown.is-open .topnav-menu {
    display: block;
}

.topnav-menu-item {
    display: flex;
    align-items: flex-start;
    padding: 0.6rem 1.1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-decoration: none;
    transition: all var(--transition);
}
.topnav-menu-item svg { flex-shrink: 0; margin-top: 2px; }

.topnav-menu-item:hover {
    color: var(--brand-primary);
    background: rgba(74,144,217,0.08);
    text-decoration: none;
}

.topnav-menu-item.active {
    color: var(--brand-primary);
    background: rgba(74,144,217,0.1);
    font-weight: 600;
    border-left: 3px solid var(--brand-primary);
    padding-left: calc(1.1rem - 3px);
}

.topnav-separator {
    height: 1px;
    background: var(--border-color);
    margin: 0.25rem 0;
}

/* ─── User Area ────────────────────────────────── */
.topbar-right { flex-shrink: 0; margin-left: auto; }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-user-name {
    display: flex;
    flex-direction: column;
    text-align: right;
    color: rgba(255,255,255,0.8);
    font-size: 0.8rem;
    text-decoration: none;
    line-height: 1.3;
}
.topbar-user-name small { font-size: 0.65rem; color: rgba(255,255,255,0.45); }

.topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    border: 2px solid rgba(255,255,255,0.3);
    text-decoration: none;
    flex-shrink: 0;
}
.topbar-avatar:hover { background: rgba(255,255,255,0.3); }

.btn-logout-top {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.15);
    text-decoration: none;
    transition: all var(--transition);
}
.btn-logout-top:hover {
    color: #fff;
    border-color: rgba(255,255,255,0.3);
    text-decoration: none;
}

.topbar-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    padding: 0;
}
.topbar-icon-btn:hover {
    background: rgba(255,255,255,0.18);
    color: #fff;
    border-color: rgba(255,255,255,0.3);
}

.topnav-dropdown--right { position: relative; }
.topnav-dropdown--right .topnav-menu {
    right: 0;
    left: auto;
}

/* ═══════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════ */

.main-topnav {
    padding: 1.5rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-header h1 { font-size: 1.5rem; }

h1 { font-size: 1.5rem; margin-bottom: 16px; }
.text-muted { color: var(--text-secondary); }
.text-center { text-align: center; }

/* ─── Card ─────────────────────────────────────── */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 20px;
    margin-bottom: 16px;
}

.card-header {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─── Table ────────────────────────────────────── */
.table-responsive { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.table th {
    background: #f8f9fa;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    color: #495057;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.table td {
    padding: 9px 12px;
    border-bottom: 1px solid #e9ecef;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.85rem;
}

.table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.table tbody tr:hover { background: #f8f9fa; }

/* ─── Badge ────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.5;
}
.badge-success { background: #d4edda; color: #155724; }
.badge-danger  { background: #f8d7da; color: #721c24; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info    { background: #d1ecf1; color: #0c5460; }

.color-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
}

/* ─── Buttons ──────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    line-height: 1.4;
}
.btn:hover { opacity: 0.9; }
.btn-primary   { background: var(--brand-primary); color: #fff; }
.btn-success   { background: var(--success); color: #fff; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-secondary { background: #6c757d; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 0.78rem; }
.btn-block { width: 100%; justify-content: center; }

/* ─── Forms ────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-control:focus {
    border-color: var(--brand-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(74,144,217,0.15);
}

.form-control[readonly] {
    background: #e9ecef;
    color: var(--text-secondary);
}

.form-row { display: flex; gap: 16px; }
.form-half { flex: 1; }

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e9ecef;
}

.form-check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

.permessi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 8px;
    padding: 8px 0;
}

.permessi-grid label {
    padding: 8px 12px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-weight: normal;
}

/* ─── Flash Messages ───────────────────────────── */
.flash {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}
.flash-success { background: #d4edda; color: #155724; border-left: 4px solid var(--success); }
.flash-error   { background: #f8d7da; color: #721c24; border-left: 4px solid var(--danger); }
.flash-warning { background: #fff3cd; color: #856404; border-left: 4px solid var(--warning); }

/* ─── Tabs ─────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 16px;
}

.tab {
    padding: 10px 20px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tab:hover { color: var(--brand-primary); }
.tab.active {
    color: var(--brand-primary);
    border-bottom-color: var(--brand-primary);
}

/* ─── KPI Cards ────────────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 16px;
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}
.kpi-icon--blue   { background: #dbeafe; color: #1e40af; }
.kpi-icon--green  { background: #d1fae5; color: #065f46; }
.kpi-icon--orange { background: #fef3c7; color: #92400e; }
.kpi-icon--purple { background: #ede9fe; color: #5b21b6; }

.kpi-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.kpi-label { font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px; }

/* ─── Dashboard Grid ───────────────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ─── Activity List ────────────────────────────── */
.activity-list { max-height: 400px; overflow-y: auto; }

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.85rem;
}

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand-primary);
    margin-top: 6px;
    flex-shrink: 0;
}

.activity-time {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ─── Online Users ─────────────────────────────── */
.online-users { display: flex; flex-direction: column; gap: 12px; }

.online-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

.online-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.online-info { flex: 1; }
.online-name { font-weight: 600; font-size: 0.9rem; }

.op-online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ─── Quick Links ──────────────────────────────── */
.quick-links { display: flex; flex-wrap: wrap; gap: 10px; }

.quick-link {
    padding: 10px 18px;
    background: #f0f2f5;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}
.quick-link:hover { background: var(--brand-primary); color: #fff; }

/* ─── Log Accessi ──────────────────────────────── */
.log-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.log-counters { display: flex; align-items: center; gap: 8px; }
.filter-form .form-row { gap: 12px; }

/* ─── Accordion Operatore ──────────────────────── */
.op-accordion {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    background: #fff;
}
.op-accordion[open] { border-color: var(--brand-primary); }

.op-summary {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.op-summary::-webkit-details-marker { display: none; }

.op-summary::before {
    content: '\25B8';
    margin-right: 10px;
    transition: transform 0.2s;
}
.op-accordion[open] .op-summary::before { transform: rotate(90deg); }

.op-summary-left { flex: 1; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.op-summary-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.op-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    background: #e9ecef;
    color: #495057;
}
.op-badge-time { background: #d1ecf1; color: #0c5460; }
.op-badge-online { background: #d4edda; color: #155724; }
.op-sessions { padding: 0 16px 16px; }

/* ─── Workspace Grid ───────────────────────────── */
.workspace-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 8px 0;
}

.workspace-card {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
}
.workspace-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.workspace-card-icon { font-size: 2rem; margin-bottom: 12px; }
.workspace-card-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 6px; }
.workspace-card-desc { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 8px; }
.workspace-card-count { font-size: 0.75rem; color: var(--text-secondary); }

/* ─── Checklist ────────────────────────────────── */
.checklist { list-style: none; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #f0f0f0; }

/* ─── Upload Widget ────────────────────────────── */
.upload-widget { margin-bottom: 16px; }

.upload-dropzone {
    border: 2px dashed #ced4da;
    border-radius: 12px;
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafbfc;
    position: relative;
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.upload-dropzone:hover,
.upload-dragover {
    border-color: var(--brand-primary);
    background: rgba(74,144,217,0.04);
    transform: scale(1.01);
}

.upload-dragover {
    border-style: solid;
    box-shadow: 0 0 0 4px rgba(74,144,217,0.15);
}

.upload-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.upload-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
    opacity: 0.5;
}

.upload-text {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 4px;
}

.upload-hint {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.upload-preview-img {
    max-height: 100px;
    max-width: 200px;
    border-radius: 8px;
    object-fit: contain;
    border: 1px solid #e9ecef;
}

.upload-preview-new {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
}

.upload-current {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
}

.upload-file-icon {
    font-size: 2.5rem;
    opacity: 0.6;
}

.upload-file-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    word-break: break-all;
}

.upload-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 0 4px;
}

.upload-progress-bar {
    flex: 1;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.upload-progress-bar::after {
    content: '';
    display: block;
    height: 100%;
    width: inherit;
    background: linear-gradient(90deg, var(--brand-primary), #28a745);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Use width on the bar element itself for JS control */
.upload-progress-bar {
    background: #e9ecef;
    position: relative;
}

.upload-progress-text {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--brand-primary);
    min-width: 36px;
}

.upload-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    justify-content: center;
}

/* ─── Login ────────────────────────────────────── */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--brand-dark) 0%, #16213e 100%);
}

.login-container { width: 100%; max-width: 400px; padding: 20px; }

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px 32px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.login-header { text-align: center; margin-bottom: 28px; }
.login-header h1 { font-size: 1.6rem; margin-bottom: 4px; color: var(--brand-dark); }
.login-header p { color: var(--text-secondary); font-size: 0.9rem; }

/* ─── Dashboard Bravin ─────────────────────────── */
.dash-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5f8a 50%, #3b82c4 100%);
    border-radius: 12px;
    padding: 36px 32px;
    margin-bottom: 20px;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(30,58,95,0.25);
}
.dash-hero::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%;
}
.dash-hero-content { position: relative; z-index: 1; }
.dash-hero-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 4px;
    letter-spacing: -0.02em;
}
.dash-hero-date {
    font-size: 0.85rem;
    opacity: 0.8;
    margin: 0;
}
.dash-hero-frase {
    font-size: 0.82rem;
    font-style: italic;
    opacity: 0.7;
    margin: 12px 0 0;
    max-width: 500px;
    line-height: 1.4;
}
.dash-hero-right {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    z-index: 1;
}
.dash-hero-brand {
    color: rgba(255,255,255,0.55);
    white-space: nowrap;
    text-align: right;
    line-height: 1.3;
}
.dash-hero-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(255,255,255,0.3);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}
.dash-hero-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Frase del giorno + Oroscopo */
.dash-frase-row {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}
.dash-frase {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    position: relative;
    overflow: hidden;
    display: flex;
    flex: 1;
    min-width: 0;
}
.dash-frase-accent {
    width: 4px;
    background: linear-gradient(180deg, #c9a96e 0%, #e8d5a8 50%, #c9a96e 100%);
    flex-shrink: 0;
}
.dash-frase-body {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    flex: 1;
}
.dash-frase-icon {
    font-size: 1.1rem;
    color: #c9a96e;
    flex-shrink: 0;
    opacity: 0.7;
    margin-top: 2px;
}
.dash-frase-text {
    margin: 0;
    font-size: 0.85rem;
    font-style: italic;
    color: #4b5563;
    line-height: 1.55;
    letter-spacing: 0.01em;
}
.dash-frase--verde .dash-frase-text {
    font-weight: 600;
    color: #166534;
}
.dash-frase-label {
    display: block;
    font-size: 0.7rem;
    color: #c9a96e;
    font-style: normal;
    margin-top: 6px;
    font-weight: 600;
}

/* Compleanno */
.dash-compleanno {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 50%, #fef9c3 100%);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(234,179,8,0.2);
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}
.dash-compleanno-confetti {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 10% 20%, #f472b6 1px, transparent 1px),
        radial-gradient(circle at 30% 80%, #60a5fa 1px, transparent 1px),
        radial-gradient(circle at 50% 10%, #a78bfa 1.5px, transparent 1.5px),
        radial-gradient(circle at 70% 70%, #34d399 1px, transparent 1px),
        radial-gradient(circle at 90% 30%, #fb923c 1px, transparent 1px),
        radial-gradient(circle at 85% 85%, #f472b6 1px, transparent 1px),
        radial-gradient(circle at 15% 60%, #60a5fa 1.5px, transparent 1.5px);
    opacity: 0.5;
}
.dash-compleanno-body {
    position: relative;
    z-index: 1;
    padding: 16px 24px;
}
.dash-compleanno-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 6px 0;
}
.dash-compleanno-item + .dash-compleanno-item {
    border-top: 1px solid rgba(180,130,20,0.15);
    margin-top: 6px;
    padding-top: 12px;
}
.dash-compleanno-icon { font-size: 2rem; flex-shrink: 0; }
.dash-compleanno-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.dash-compleanno-info strong {
    font-size: 0.95rem;
    color: #92400e;
}
.dash-compleanno-eta {
    font-size: 0.72rem;
    color: #b45309;
    font-weight: 600;
}
.dash-compleanno-frase {
    font-size: 0.82rem;
    color: #78350f;
    font-style: italic;
}
.dash-compleanno-emoji { font-size: 1.5rem; flex-shrink: 0; }

/* Frase verde */
.dash-frase--verde { background: #f0fdf4; }

/* Oroscopo */
.dash-frase--oroscopo { background: #faf5ff; }
.dash-oroscopo-segno {
    font-size: 1.6rem;
    flex-shrink: 0;
    margin-top: -2px;
    line-height: 1;
}

@media (max-width: 900px) {
    .dash-frase-row { flex-direction: column; }
}

.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}
.dash-col { display: flex; flex-direction: column; gap: 16px; }

.dash-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    overflow: hidden;
}
.dash-card--alert { border-left: 4px solid #059669; margin-bottom: 20px; }
.dash-card--warning { border-left: 4px solid #DC2626; }

.dash-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    font-weight: 600;
    font-size: 0.88rem;
    color: #1f2937;
    border-bottom: 1px solid #f3f4f6;
}
.dash-card-icon { font-size: 1rem; flex-shrink: 0; }
.dash-link-sm {
    margin-left: auto;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--brand-primary);
    text-decoration: none;
}
.dash-link-sm:hover { text-decoration: underline; }

.dash-list { }
.dash-list--compact .dash-list-item { padding: 8px 18px; }

.dash-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    border-bottom: 1px solid #f5f5f5;
    font-size: 0.84rem;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}
.dash-list-item:last-child { border-bottom: none; }
a.dash-list-item:hover { background: #f8f9fa; }

.dash-list-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.dash-list-sub {
    font-size: 0.74rem;
    color: #9ca3af;
}
.dash-list-meta {
    margin-left: auto;
    font-size: 0.72rem;
    color: #9ca3af;
    white-space: nowrap;
}

.dash-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}
.dash-badge--red { background: #FEE2E2; color: #991B1B; }
.dash-badge--red-sm { background: #FEE2E2; color: #991B1B; font-size: 0.6rem; padding: 1px 6px; }
.dash-badge--blue { background: #DBEAFE; color: #1E40AF; }
.dash-badge--green { background: #D1FAE5; color: #065F46; }
.dash-badge--amber { background: #FEF3C7; color: #92400E; border-radius: 10px; }

/* Riunioni */
.dash-riunione {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 18px;
    border-bottom: 1px solid #f5f5f5;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}
.dash-riunione:last-child { border-bottom: none; }
.dash-riunione:hover { background: #f8f9fa; }
.dash-riunione--oggi { background: #EFF6FF; }
.dash-riunione--oggi:hover { background: #DBEAFE; }
.dash-riunione-data {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 44px;
    line-height: 1.1;
}
.dash-riunione-giorno { font-size: 0.6rem; color: #9ca3af; text-transform: uppercase; }
.dash-riunione-num { font-size: 1.2rem; font-weight: 700; color: #374151; }
.dash-riunione-mese { font-size: 0.58rem; color: #9ca3af; }
.dash-riunione-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.84rem;
}

/* Checklist progress */
.dash-progress-ring {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: conic-gradient(var(--prog-color) var(--prog), #e5e7eb var(--prog));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}
.dash-progress-ring::before {
    content: '';
    width: 30px;
    height: 30px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
}
.dash-progress-ring span {
    position: relative;
    z-index: 1;
    font-size: 0.58rem;
    font-weight: 700;
    color: #374151;
}

/* Manutenzione */
.dash-mn-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-bottom: 1px solid #f5f5f5;
    font-size: 0.82rem;
    transition: all 0.3s;
}
.dash-mn-item:last-child { border-bottom: none; }
.dash-mn-check {
    width: 22px;
    height: 22px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
}
.dash-mn-check:hover { border-color: #22C55E; background: #D1FAE5; }
.dash-mn-check.checked { background: #22C55E; border-color: #22C55E; color: #fff; }
.dash-mn-nome { flex: 1; }
.dash-mn-fatte {
    padding: 8px 18px;
    background: #f9fafb;
    font-size: 0.72rem;
    color: #6B7280;
}

/* KPI */
.dash-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
}
.dash-kpi {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 8px;
    border-right: 1px solid #f3f4f6;
}
.dash-kpi:last-child { border-right: none; }
.dash-kpi-val { font-size: 1.5rem; font-weight: 700; color: #1f2937; line-height: 1; }
.dash-kpi-val small { font-size: 0.65rem; font-weight: 500; color: #9ca3af; }
.dash-kpi-lbl { font-size: 0.7rem; color: #9ca3af; margin-top: 4px; }

/* Online */
.dash-online-grid { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 18px; }
.dash-online-user { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.dash-online-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
}
.dash-online-name { font-size: 0.65rem; color: #6B7280; }

.dash-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 24px 18px;
    color: #9ca3af;
    font-size: 0.84rem;
}
.dash-empty-icon { font-size: 1.5rem; opacity: 0.5; }

.dash-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1F2937;
    margin: 8px 0 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid #F59E0B;
}

.dash-stat {
    margin: 0;
    text-align: center;
    padding: 16px;
}
.dash-stat-val { font-size: 2rem; font-weight: 700; }
.dash-stat-lbl { font-size: 0.8rem; color: #666; }

/* ─── Responsive ───────────────────────────────── */
@media (max-width: 1024px) {
    .dash-grid { grid-template-columns: 1fr; }
    .topbar { height: 48px; padding: 0 1rem; }
    .topnav-item { height: 48px; font-size: 0.8rem; padding: 0 0.6rem; }
    .topbar-user-name { display: none; }
    .main-topnav { padding: 1rem; }
    .dashboard-grid { grid-template-columns: 1fr; }
}

/* ─── Layout 2 colonne operatore ──────────────── */
.operatore-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}
.operatore-col-left {
    flex: 1;
    min-width: 0;
}
.operatore-col-right {
    width: 380px;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

/* ─── Tabella permessi ────────────────────────── */
.perm-area { border-bottom: 1px solid #e9ecef; }
.perm-area:last-child { border-bottom: none; }

.perm-area-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #f8f9fa;
    cursor: pointer;
    user-select: none;
    font-size: 0.9rem;
}
.perm-area-header:hover { background: #f1f3f5; }

.perm-area-cb {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

.perm-area-count {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: normal;
}

.perm-area-items { }

.perm-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px 7px 40px;
    font-size: 0.85rem;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.15s;
}
.perm-item:last-child { border-bottom: none; }
.perm-item:hover { background: #f8f9fa; }

.perm-item input[type="checkbox"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--primary);
}

.perm-saved {
    animation: permSavedFlash 0.4s ease;
}
@keyframes permSavedFlash {
    0% { background: #d4edda; }
    100% { background: transparent; }
}

@media (max-width: 1100px) {
    .operatore-layout { flex-direction: column; }
    .operatore-col-right {
        width: 100%;
        position: static;
        max-height: none;
    }
}

@media (max-width: 768px) {
    .topbar { flex-wrap: wrap; height: auto; padding: 0.5rem 1rem; }
    .topbar-left { width: 100%; margin-right: 0; margin-bottom: 0.25rem; }
    .topbar-nav { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .topbar-right { display: none; }
    .main-topnav { padding: 0.75rem; }
    .form-row { flex-direction: column; gap: 0; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .op-summary { flex-wrap: wrap; }
    .op-summary-right { margin-top: 6px; width: 100%; }
}

/* ═══════════════════════════════════════════════════
   ADMIN MEGA-PANEL DROPDOWN
   Refined editorial layout for the Pannello di Controllo.
   ═══════════════════════════════════════════════════ */

.topnav-menu--panel {
    width: 560px;
    min-width: 560px;
    padding: 0;
    border-radius: 0 0 14px 14px;
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-top: 3px solid var(--brand-primary);
    box-shadow:
        0 28px 56px -16px rgba(15, 23, 42, 0.22),
        0 10px 20px -10px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    background: #ffffff;
    display: block;
    opacity: 0;
    transform: translateY(-6px) scale(0.985);
    visibility: hidden;
    transition:
        opacity 0.18s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.22s cubic-bezier(0.4, 0, 0.2, 1),
        visibility 0s linear 0.18s;
}
.topnav-dropdown:hover .topnav-menu--panel,
.topnav-dropdown.is-open .topnav-menu--panel,
.topnav-dropdown:focus-within .topnav-menu--panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
    transition:
        opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.22s cubic-bezier(0.4, 0, 0.2, 1),
        visibility 0s linear 0s;
}

.adm-panel-header {
    padding: 16px 20px 14px;
    background:
        linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e5e9f0;
    display: flex;
    align-items: center;
    gap: 12px;
}
.adm-panel-header__icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand-primary) 0%, #2c3e50 120%);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px -2px rgba(74, 144, 217, 0.4);
    flex-shrink: 0;
}
.adm-panel-header__text { line-height: 1.2; flex: 1; }
.adm-panel-header__eyebrow {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.6px;
    color: var(--brand-primary);
    margin-bottom: 2px;
}
.adm-panel-header__title {
    font-family: 'Georgia', 'Source Serif Pro', 'Garamond', serif;
    font-size: 1.02rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.2px;
}
.adm-panel-header__subtitle {
    font-size: 0.7rem;
    color: #64748b;
    margin-top: 1px;
}

.adm-panel-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    padding: 6px;
    background: #ffffff;
}
.adm-section {
    padding: 10px 8px 6px;
}
.adm-section + .adm-section-col-right {
    border-left: 1px solid #f1f5f9;
}
.adm-section-title {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    color: #94a3b8;
    padding: 0 10px 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.adm-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, #e2e8f0 0%, transparent 100%);
}

.adm-link {
    display: grid;
    grid-template-columns: 30px 1fr;
    align-items: center;
    gap: 11px;
    padding: 8px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: #334155;
    transition:
        background-color 0.16s ease,
        color 0.16s ease,
        transform 0.16s ease;
    position: relative;
    isolation: isolate;
}
.adm-link::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background: var(--brand-primary);
    border-radius: 2px;
    opacity: 0;
    transform: scaleY(0.4);
    transform-origin: center;
    transition: opacity 0.16s ease, transform 0.18s ease;
}
.adm-link:hover {
    background: #f8fafc;
    color: #0f172a;
    text-decoration: none;
}
.adm-link:hover::before {
    opacity: 1;
    transform: scaleY(1);
}
.adm-link.is-active {
    background: rgba(74, 144, 217, 0.09);
    color: var(--brand-primary);
}
.adm-link.is-active::before {
    opacity: 1;
    transform: scaleY(1);
}
.adm-link-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #f1f5f9;
    color: var(--brand-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background-color 0.16s ease, color 0.16s ease;
}
.adm-link:hover .adm-link-icon {
    background: rgba(74, 144, 217, 0.16);
}
.adm-link.is-active .adm-link-icon {
    background: var(--brand-primary);
    color: #fff;
}
.adm-link-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
}
.adm-link-title {
    font-size: 0.81rem;
    font-weight: 600;
    color: inherit;
    letter-spacing: -0.1px;
}
.adm-link-desc {
    font-size: 0.66rem;
    color: #94a3b8;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.adm-panel-footer {
    padding: 8px 18px;
    background: #fafbfc;
    border-top: 1px solid #f1f5f9;
    font-size: 0.65rem;
    color: #94a3b8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    letter-spacing: 0.2px;
}
.adm-panel-footer kbd {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.6rem;
    padding: 1px 6px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    color: #475569;
    box-shadow: inset 0 -1px 0 #e2e8f0;
}

@media (max-width: 720px) {
    .topnav-menu--panel {
        width: min(96vw, 480px);
        min-width: auto;
    }
    .adm-panel-body { grid-template-columns: 1fr; }
    .adm-section + .adm-section-col-right { border-left: 0; border-top: 1px solid #f1f5f9; }
}

/* ═══════════════════════════════════════════════════
   MOBILE FOUNDATION — drawer + bottom nav + responsive
   ═══════════════════════════════════════════════════ */

:root {
    --mobile-bp: 900px;
    --mobile-bp-strict: 720px;
    --tap-target: 44px;
    --drawer-w: min(88vw, 340px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
}

/* ─── Hamburger trigger (visibile solo mobile) ── */
.topbar-burger {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.08);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    margin-right: 10px;
    flex-shrink: 0;
    padding: 0;
    transition: background 0.2s ease;
}
.topbar-burger:hover { background: rgba(255,255,255,0.16); }
.topbar-burger:active { background: rgba(255,255,255,0.22); }
.topbar-burger__bar {
    width: 18px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.topbar-burger[aria-expanded="true"] .topbar-burger__bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
.topbar-burger[aria-expanded="true"] .topbar-burger__bar:nth-child(2) {
    opacity: 0;
}
.topbar-burger[aria-expanded="true"] .topbar-burger__bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* ─── Scrim ──────────────────────────────────── */
.mobile-scrim {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0s linear 0.22s;
}
.mobile-scrim.is-open {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.22s ease, visibility 0s linear 0s;
}

/* ─── Drawer ─────────────────────────────────── */
.mobile-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--drawer-w);
    background: linear-gradient(165deg, #1e3a5f 0%, #2C3E50 65%, #1f2937 100%);
    color: #fff;
    z-index: 1110;
    display: flex;
    flex-direction: column;
    transform: translateX(-105%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 8px 0 32px rgba(0,0,0,0.35);
    padding-top: var(--safe-top);
    overflow: hidden;
}
.mobile-drawer.is-open {
    transform: translateX(0);
}
.mobile-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 18px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.mobile-drawer__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.mobile-drawer__logo {
    height: 34px;
    width: auto;
    border-radius: 6px;
    background: rgba(255,255,255,0.92);
    padding: 4px;
    flex-shrink: 0;
}
.mobile-drawer__eyebrow {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.6px;
    color: rgba(255,255,255,0.5);
}
.mobile-drawer__title {
    font-family: 'Georgia', 'Source Serif Pro', serif;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.2px;
}
.mobile-drawer__close {
    width: var(--tap-target);
    height: var(--tap-target);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s ease;
    padding: 0;
}
.mobile-drawer__close:active { background: rgba(255,255,255,0.16); }

.mobile-drawer__user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    flex-shrink: 0;
}
.mobile-drawer__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.12);
    color: #fff;
}
.mobile-drawer__avatar--initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}
.mobile-drawer__user-text {
    flex: 1;
    line-height: 1.2;
    min-width: 0;
}
.mobile-drawer__user-text strong {
    display: block;
    font-size: 0.86rem;
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mobile-drawer__user-text small {
    display: block;
    font-size: 0.66rem;
    color: rgba(255,255,255,0.55);
    margin-top: 1px;
    letter-spacing: 0.2px;
}
.mobile-drawer__user-link {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    flex-shrink: 0;
    transition: all 0.18s ease;
}
.mobile-drawer__user-link:active {
    background: rgba(255,255,255,0.18);
    color: #fff;
    text-decoration: none;
}

.mobile-drawer__nav {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 10px 16px;
    overscroll-behavior: contain;
}
.mobile-section { padding: 12px 0 8px; }
.mobile-section__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.6px;
    color: rgba(255,255,255,0.42);
    padding: 0 12px 8px;
}
.mobile-section__icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(74, 144, 217, 0.18);
    color: var(--brand-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.mobile-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 12px;
    min-height: var(--tap-target);
    border-radius: 8px;
    color: rgba(255,255,255,0.82);
    font-size: 0.92rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
    position: relative;
}
.mobile-link:active {
    background: rgba(255,255,255,0.06);
    transform: scale(0.99);
    color: #fff;
    text-decoration: none;
}
.mobile-link.is-active {
    background: rgba(74,144,217,0.18);
    color: #fff;
}
.mobile-link.is-active::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 12px;
    bottom: 12px;
    width: 3px;
    background: var(--brand-primary);
    border-radius: 2px;
}
.mobile-link__chev {
    opacity: 0.4;
    flex-shrink: 0;
}

.mobile-drawer__footer {
    display: flex;
    gap: 8px;
    padding: 12px 14px calc(14px + var(--safe-bottom));
    border-top: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.18);
    flex-shrink: 0;
}
.mobile-drawer__footer-link {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--tap-target);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
    color: #fff;
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    transition: background 0.18s ease;
}
.mobile-drawer__footer-link:active {
    background: rgba(255,255,255,0.18);
    text-decoration: none;
}
.mobile-drawer__footer-link--danger {
    background: rgba(220, 38, 38, 0.18);
    border-color: rgba(220, 38, 38, 0.28);
    color: #fee2e2;
}
.mobile-drawer__footer-link--danger:active {
    background: rgba(220, 38, 38, 0.28);
}

/* ─── Bottom nav ─────────────────────────────── */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 90;
    background: rgba(44, 62, 80, 0.96);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 -8px 24px rgba(0,0,0,0.22);
    padding-bottom: var(--safe-bottom);
    justify-content: space-around;
    align-items: stretch;
}
.mobile-bottom-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 4px 6px;
    min-height: 56px;
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: color 0.18s ease, transform 0.18s ease;
    position: relative;
}
.mobile-bottom-nav__item:active {
    transform: scale(0.94);
    color: rgba(255,255,255,0.85);
    text-decoration: none;
}
.mobile-bottom-nav__icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s ease, color 0.18s ease;
}
.mobile-bottom-nav__item.is-active { color: #fff; }
.mobile-bottom-nav__item.is-active .mobile-bottom-nav__icon {
    background: linear-gradient(135deg, var(--brand-primary) 0%, #5a9ee4 100%);
    color: #fff;
    box-shadow: 0 4px 12px -2px rgba(74,144,217,0.5);
}
.mobile-bottom-nav__label {
    line-height: 1;
    text-transform: uppercase;
}

/* ─── Body lock quando drawer aperto ─────────── */
body.mobile-locked { overflow: hidden; }

/* ═══════════════════════════════════════════════
   BREAKPOINT MOBILE — adattamenti generali
   ═══════════════════════════════════════════════ */
@media (max-width: 900px) {
    .topbar-burger { display: inline-flex; }
    .topbar-nav { display: none; }
    .topbar-user-name { display: none; }

    .topbar {
        padding: 0 12px;
        padding-top: var(--safe-top);
        height: calc(56px + var(--safe-top));
    }
    .topbar-left {
        margin-right: 0;
        flex: 1;
        justify-content: center;
        display: flex;
    }
    .topbar-brand {
        margin-left: auto;
        margin-right: auto;
    }
    .topbar-logo { height: 30px; }

    /* nasconde i pulsanti di servizio meno usati su mobile */
    #keepaliveToggle { display: none; }
    .topbar-right .topnav-dropdown--right { display: none; } /* admin gear va nel drawer */

    /* main content: spazio per bottom nav */
    .main-topnav {
        padding: 1rem 12px calc(72px + var(--safe-bottom));
    }

    .mobile-bottom-nav { display: flex; }

    /* card e form più strette su mobile */
    .card { padding: 12px !important; border-radius: 10px; }
    .page-header h1 { font-size: 1.15rem; }
    .page-header { gap: 8px; }

    /* tabelle scrollabili orizzontalmente */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -12px;
        padding: 0 12px;
    }
    .table { min-width: 560px; }

    /* form: input touch-friendly + niente zoom su iOS (font-size >= 16px) */
    .form-control, input[type="text"], input[type="email"], input[type="password"],
    input[type="number"], input[type="date"], input[type="search"], input[type="tel"],
    textarea, select {
        font-size: 16px !important;
        min-height: var(--tap-target);
    }
    textarea { min-height: calc(var(--tap-target) * 2); }

    .btn { min-height: var(--tap-target); }
    .btn-sm { min-height: 38px; }

    /* override dropdown desktop nascosti su mobile */
    .topnav-menu, .topnav-menu--panel { display: none !important; }

    /* page-header con bottoni che vanno su nuova riga */
    .page-header[style*="flex"] { flex-direction: column; align-items: stretch !important; }
}

@media (max-width: 540px) {
    .main-topnav { padding-left: 10px; padding-right: 10px; }
    .topbar-brand { font-size: 0.95rem; }
    .mobile-drawer__title { font-size: 0.92rem; }
}

/* Standalone mode (installata come app): meno chrome */
@media (display-mode: standalone) {
    .topbar { padding-top: max(var(--safe-top), 8px); }
    body { overscroll-behavior-y: contain; }
}
