/* ===== ConsolidatorWeb Design System ===== */

:root {
    /* Brand Travella and Partners: Pantone 314U / 3025U (brand manual mag 2025) */
    --primary: #337e9c;
    --primary-light: #5b99b2;
    --primary-dark: #104552;
    --accent-cyan: #4f93ad;
    --accent-violet: #1d6076;
    --accent-rose: #7fb3c8;
    --accent-gold: #2a6f8a;
    --green: #22c55e;
    --red: #ef4444;
    --bg: #f3f7f9;
    --bg-card: #ffffff;
    --bg-sidebar: #0d3a49;
    --bg-header: rgba(243,247,249,0.8);
    --bg-input: #e9f0f3;
    --bg-hover: #eef4f6;
    --text: #0e2a33;
    --text-secondary: #4d6b77;
    --text-muted: #7d97a1;
    --border: #dbe6ea;
    --border-light: #edf3f5;
    --radius: 12px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --font: 'Albert Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --transition: 150ms ease;
}

.dark {
    --bg: #071e26;
    --bg-card: #0d3340;
    --bg-sidebar: #0a2a35;
    --bg-header: rgba(7,30,38,0.8);
    --bg-input: #14424f;
    --bg-hover: #124251;
    --text: #e8f1f4;
    --text-secondary: #93b4bf;
    --text-muted: #5f8290;
    --border: #1c4d5c;
    --border-light: #123c49;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
a.btn:hover { color: inherit; }

/* ===== Layout ===== */
.app-layout { display: flex; min-height: 100vh; position: relative; }
.app-layout::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: var(--sidebar-w, 260px); background: var(--bg-sidebar); border-right: 1px solid var(--border); z-index: 0; pointer-events: none; }

.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 50;
    flex-shrink: 0;
    position: relative;
}

.sidebar-brand { padding: 2rem 0 1.5rem; display: block; text-align: center; }
.sidebar-brand img { height: 32px; transition: height 0.25s ease; }
.sidebar.collapsed .sidebar-brand img { height: 22px; }
.sidebar-brand-icon { width: 40px; height: 40px; background: var(--primary); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.25rem; flex-shrink: 0; }
.sidebar-brand-text { font-weight: 700; font-size: 1.25rem; letter-spacing: -0.025em; }

.sidebar-nav { flex: 1; padding: 0 1rem; overflow-y: auto; }
.sidebar-label { font-size: 0.625rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); padding: 1.25rem 0.75rem 0.5rem; }
.sidebar.collapsed .sidebar-label { display: none; }
.sidebar-nav a { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; border-radius: var(--radius); color: var(--text-secondary); font-weight: 500; font-size: 0.875rem; transition: all var(--transition); }
.sidebar-nav a:hover { color: var(--primary); background: var(--bg-hover); }
.sidebar-nav a.active { color: var(--primary); background: rgba(51,126,156,0.1); font-weight: 600; }

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

.main-content { flex: 1; overflow-x: hidden; }

/* ===== Header ===== */
.header { position: sticky; top: 0; z-index: 40; background: var(--bg-header); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); padding: 1rem 2rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.header-title { font-size: 1.25rem; font-weight: 700; }
.header-subtitle { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }
.header-actions { display: flex; align-items: center; gap: 1rem; }

.page-content { padding: 2rem; max-width: 1400px; margin: 0 auto; }

/* ===== Cards ===== */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-xl); overflow: hidden; box-shadow: var(--shadow-sm); }
.card-header { padding: 1.5rem; border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: center; }
.card-body { padding: 1.5rem; }
.card-title { font-weight: 700; font-size: 1rem; }
.card-subtitle { font-size: 0.75rem; color: var(--text-muted); }

.card-stat { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 2rem; box-shadow: var(--shadow-sm); position: relative; }

.card-hero { background: var(--primary); border-radius: var(--radius-xl); padding: 2rem; color: #fff; position: relative; overflow: hidden; box-shadow: 0 20px 25px -5px rgba(51,126,156,0.2); }
.card-hero::before { content: ''; position: absolute; top: -3rem; right: -3rem; width: 12rem; height: 12rem; background: rgba(255,255,255,0.1); border-radius: 50%; filter: blur(40px); }

/* ===== Grid ===== */
.grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.625rem 1.25rem; border-radius: var(--radius); font-family: var(--font); font-weight: 600; font-size: 0.875rem; border: none; cursor: pointer; transition: all var(--transition); line-height: 1.5; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; }
.btn-block { width: 100%; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; }

/* ===== Forms ===== */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.05em; }
.form-input, .form-select { width: 100%; padding: 0.75rem 1rem; background: var(--bg-input); border: 1px solid transparent; border-radius: var(--radius); font-family: var(--font); font-size: 0.875rem; color: var(--text); transition: all var(--transition); outline: none; }
.form-input:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(51,126,156,0.15); background: var(--bg-card); }
.form-input::placeholder { color: var(--text-muted); }

.input-group { position: relative; display: flex; align-items: center; }
.input-group .form-input { padding-left: 2.75rem; }
.input-group-icon { position: absolute; left: 1rem; color: var(--text-muted); pointer-events: none; font-size: 1.125rem; }
.input-group-end { position: absolute; right: 0.75rem; background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 0.25rem; }

.form-check { display: flex; align-items: center; gap: 0.5rem; }
.form-check input[type="checkbox"] { width: 1rem; height: 1rem; accent-color: var(--primary); }
.form-check label { font-size: 0.875rem; color: var(--text-secondary); cursor: pointer; }

/* ===== Tables ===== */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
thead th { padding: 1rem; font-size: 0.625rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); border-bottom: 1px solid var(--border); }
tbody td { padding: 1rem; font-size: 0.875rem; font-weight: 500; border-bottom: 1px solid var(--border-light); }
tbody tr:hover { background: var(--bg-hover); }

/* ===== Badges ===== */
.badge { display: inline-flex; align-items: center; padding: 0.25rem 0.75rem; border-radius: var(--radius-full); font-size: 0.75rem; font-weight: 600; }
.badge-primary { background: rgba(51,126,156,0.1); color: var(--primary); }
.badge-green { background: rgba(34,197,94,0.1); color: var(--green); }
.badge-red { background: rgba(239,68,68,0.1); color: var(--red); }
.badge-gold { background: rgba(42,111,138,0.1); color: #d97706; }

/* ===== Avatar ===== */
.avatar { width: 40px; height: 40px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.875rem; color: #fff; flex-shrink: 0; }
.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.bg-primary { background: var(--primary); }
.bg-success { background: var(--green); }
.bg-danger { background: var(--red); }
.bg-warning { background: var(--accent-gold); }
.bg-info { background: var(--accent-cyan); }
.bg-secondary { background: var(--text-muted); }

/* ===== Progress ===== */
.progress { height: 0.5rem; background: var(--border-light); border-radius: var(--radius-full); overflow: hidden; }
.progress-bar { height: 100%; border-radius: var(--radius-full); transition: width 0.6s ease; }

/* ===== Toggle Group ===== */
.toggle-group { display: flex; background: var(--bg-input); border-radius: var(--radius); padding: 0.25rem; }
.toggle-group button { padding: 0.375rem 1rem; font-size: 0.75rem; font-weight: 600; border: none; border-radius: 0.5rem; background: transparent; color: var(--text-muted); cursor: pointer; font-family: var(--font); transition: all var(--transition); }
.toggle-group button:hover:not(.active) { color: var(--text-secondary); background: rgba(51,126,156,0.05); }
.toggle-group button.active { background: var(--bg-card); color: var(--text); box-shadow: var(--shadow-sm); }

/* ===== Alerts ===== */
.alert { padding: 1rem 1.25rem; border-radius: var(--radius); font-size: 0.875rem; font-weight: 500; display: flex; align-items: center; gap: 0.75rem; }
.alert-error { background: rgba(239,68,68,0.1); color: var(--red); }
.alert-success { background: rgba(34,197,94,0.1); color: var(--green); }

/* ===== Modal ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); z-index: 100; display: none; align-items: center; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal { background: var(--bg-card); border-radius: var(--radius-xl); padding: 2rem; max-width: 440px; width: 90%; box-shadow: var(--shadow-lg); }
.modal-title { font-size: 1.125rem; font-weight: 700; margin-bottom: 1rem; }

/* ===== Auth Pages ===== */
.auth-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem; background: var(--bg); }
.auth-card { width: 100%; max-width: 440px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 3rem; box-shadow: var(--shadow-lg); }
.auth-logo { display: flex; align-items: center; justify-content: center; gap: 0.75rem; margin-bottom: 2.5rem; }
.auth-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.auth-subtitle { color: var(--text-secondary); font-size: 0.875rem; margin-bottom: 2rem; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
.dark ::-webkit-scrollbar-thumb { background: #1c4d5c; }

/* ===== Utilities ===== */
.text-primary { color: var(--primary); }
.text-cyan { color: var(--accent-cyan); }
.text-rose { color: var(--accent-rose); }
.text-gold { color: var(--accent-gold); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-white { color: #fff; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-uppercase { text-transform: uppercase; letter-spacing: 0.05em; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }

.w-full { width: 100%; }
.hidden { display: none; }
.relative { position: relative; }
.overflow-hidden { overflow: hidden; }
.shrink-0 { flex-shrink: 0; }
.flex-1 { flex: 1; }

/* ===== User Menu Dropdown ===== */
.user-menu { position: absolute; top: calc(100% + 0.5rem); right: 0; width: 240px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 100; opacity: 0; visibility: hidden; transform: translateY(-8px); transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s; }
.user-menu.show { opacity: 1; visibility: visible; transform: translateY(0); }
.user-menu-header { display: flex; align-items: center; gap: 0.75rem; padding: 1rem 1.25rem; }
.user-menu-divider { height: 1px; background: var(--border); margin: 0.25rem 0; }
.user-menu-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 1.25rem; color: var(--text-secondary); font-size: 0.8125rem; font-weight: 500; transition: all var(--transition); text-decoration: none; }
.user-menu-item:hover { color: var(--primary); background: var(--bg-hover); }
.user-menu-item .material-symbols-outlined { font-size: 18px; }
.user-menu-item-danger { color: var(--red); }
.user-menu-item-danger:hover { color: var(--red); background: rgba(239,68,68,0.05); }

/* ===== Animations ===== */
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Stagger animation for cards */
.page-content .card, .page-content .card-stat, .page-content .card-hero {
    animation: fadeInUp 0.5s ease both;
}
.page-content > :nth-child(1) { animation-delay: 0s; }
.page-content > :nth-child(2) { animation-delay: 0.05s; }
.page-content > :nth-child(3) { animation-delay: 0.1s; }
.page-content > :nth-child(4) { animation-delay: 0.15s; }
.page-content > :nth-child(5) { animation-delay: 0.2s; }
.page-content > :nth-child(6) { animation-delay: 0.25s; }

/* Grid children stagger */
.grid > .card, .grid > .card-stat, .grid > .card-hero {
    animation: fadeInUp 0.5s ease both;
}
.grid > :nth-child(1) { animation-delay: 0s; }
.grid > :nth-child(2) { animation-delay: 0.08s; }
.grid > :nth-child(3) { animation-delay: 0.16s; }
.grid > :nth-child(4) { animation-delay: 0.24s; }

/* Card hover lift */
.card-stat { transition: transform 0.25s ease, box-shadow 0.25s ease; }
.card-stat:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.card { transition: transform 0.25s ease, box-shadow 0.25s ease; }
.card:hover { box-shadow: var(--shadow); }

.card-hero { transition: transform 0.25s ease, box-shadow 0.25s ease; }
.card-hero:hover { transform: translateY(-2px); box-shadow: 0 25px 30px -5px rgba(51,126,156,0.3); }

/* Header slide in */
.header { animation: fadeIn 0.4s ease; }

/* Badge pulse on change */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}
.badge-animate { animation: pulse 0.3s ease; }

/* Chart container fade */
.apexcharts-canvas { animation: fadeIn 0.6s ease; }

/* Progress bar animate width */
.progress-bar { transition: width 0.8s ease; }

/* Modal smooth */
.modal-overlay { transition: opacity 0.25s ease; }
.modal-overlay.show .modal { animation: scaleIn 0.25s ease; }

/* Sidebar nav links */
.sidebar-nav a { transition: all 0.2s ease, background 0.2s ease, color 0.2s ease; }

/* Table row hover */
tbody tr { transition: background 0.15s ease; }

/* Avatar hover */
.avatar { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.avatar:hover { transform: scale(1.08); box-shadow: var(--shadow); }

/* Toggle group smooth */
.toggle-group button { transition: all 0.2s ease; }

/* Badge smooth */
.badge { transition: all 0.2s ease; }

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== Dashboard Layout ===== */
/* La colonna destra deve avere la stessa larghezza di una colonna della grid-4
   sopra (25% meno la quota dei 3 gap), altrimenti Statistical Data sborda di
   mezzo gap rispetto alla card Performance */
#perf-row { grid-template-columns: 1fr calc(25% - 1.125rem); align-items: stretch; }
#alloc-inner { display: grid; grid-template-columns: 1fr 1px 1fr; gap: 0; align-items: start; }
#contrib-row { grid-template-columns: 1fr 1fr; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .sidebar { width: 72px; }
    .sidebar-brand-text, .sidebar-nav span:not(.material-symbols-outlined), .sidebar-footer span:not(.material-symbols-outlined), .sidebar-label { display: none; }
    .sidebar-nav a { justify-content: center; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .page-content { padding: 1.5rem; }
    .lg-hide { display: none; }
    #perf-row { grid-template-columns: 1fr; }
    #contrib-row { grid-template-columns: 1fr; }
    #filter-bar { grid-template-columns: 1fr 1fr !important; }
    #tw-kpis { grid-template-columns: repeat(2, 1fr) !important; }
    #tw-allocs { grid-template-columns: 1fr !important; }
    .header-actions { flex-wrap: wrap; gap: 0.75rem; }
    #report-select { min-width: 180px !important; }
    .card-hero { grid-column: span 2; }
}

@media (max-width: 768px) {
    .sidebar { position: fixed; left: -260px; transition: left 0.3s ease; width: 260px; height: 100vh; z-index: 50; }
    .sidebar-nav span:not(.material-symbols-outlined), .sidebar-footer span:not(.material-symbols-outlined) { display: inline !important; }
    .sidebar-label { display: block !important; }
    .sidebar-nav a { justify-content: flex-start !important; }
    .sidebar.open { left: 0; }
    .sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 49; display: none; }
    .sidebar-overlay.show { display: block; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .header { padding: 1rem; flex-wrap: wrap; gap: 0.75rem; }
    .header > div:first-child { width: 100%; }
    .header-actions { width: 100%; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }
    #report-select { min-width: 100% !important; max-width: 100% !important; }
    .page-content { padding: 1rem; }
    .auth-card { padding: 2rem; }
    .md-hide { display: none; }
    #perf-row { grid-template-columns: 1fr; }
    #alloc-inner, #tw-alloc-inner, #pf-alloc-inner, #oa-alloc-inner { grid-template-columns: 1fr !important; }
    #alloc-inner > div:nth-child(2), #tw-alloc-inner > div:nth-child(2), #pf-alloc-inner > div:nth-child(2), #oa-alloc-inner > div:nth-child(2) { display: none !important; }
    #alloc-inner > div:last-child, #tw-alloc-inner > div:last-child, #pf-alloc-inner > div:last-child, #oa-alloc-inner > div:last-child { padding-left: 0 !important; max-height: 250px !important; overflow-y: auto !important; }
    #alloc-inner > div:first-child, #tw-alloc-inner > div:first-child, #pf-alloc-inner > div:first-child, #oa-alloc-inner > div:first-child { padding-right: 0 !important; }
    #contrib-row { grid-template-columns: 1fr; }
    #filter-bar { grid-template-columns: 1fr !important; }
    #products-table { table-layout: auto !important; }
    #tw-kpis { grid-template-columns: 1fr !important; }
    #tw-allocs { grid-template-columns: 1fr !important; }
    #pm-bottom { grid-template-columns: 1fr !important; }
    #io-kpis { grid-template-columns: 1fr !important; }
    #pm-kpis { grid-template-columns: 1fr !important; }
    .card-hero { grid-column: span 1 !important; }
    .grid-4 { grid-template-columns: 1fr !important; }
    .grid-4 .card-hero { grid-column: span 1 !important; }
    .grid-4 .card-stat { width: 100%; }
    .card-header { flex-wrap: wrap; gap: 0.75rem; }
    .text-4xl { font-size: 1.5rem; }
    .text-3xl { font-size: 1.25rem; }
    .toggle-group { font-size: 0.6875rem; }
    .toggle-group button { padding: 0.3rem 0.625rem; }
}

/* ===== Sidebar Collapse (desktop) ===== */
.sidebar { transition: width 0.25s ease; }
.sidebar-toggle { position: absolute; top: 1.25rem; right: -14px; width: 28px; height: 28px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 51; box-shadow: var(--shadow-sm); color: var(--text-muted); transition: all var(--transition); }
.sidebar-toggle:hover { color: var(--primary); border-color: var(--primary); }
.sidebar-toggle .material-symbols-outlined { font-size: 18px; transition: transform 0.25s ease; }

.sidebar.collapsed { width: 72px; }
.sidebar.collapsed .sidebar-brand-text { display: none; }
.sidebar.collapsed .sidebar-nav span:not(.material-symbols-outlined) { display: none; }
.sidebar.collapsed .sidebar-footer span:not(.material-symbols-outlined) { display: none; }
.sidebar.collapsed .sidebar-nav a { justify-content: center; padding: 0.75rem; }
.sidebar.collapsed .sidebar-toggle .material-symbols-outlined { transform: rotate(180deg); }

@media (max-width: 1024px) {
    .sidebar-toggle { display: none; }
    .sidebar.collapsed { width: 72px; }
}

@media (max-width: 768px) {
    .sidebar-toggle { display: none !important; }
    .sidebar.collapsed { width: 260px; left: -260px; position: fixed; }
}

.app-layout::before { transition: width 0.25s ease; }
@media (max-width: 1024px) { .app-layout::before { width: 72px; } }
@media (max-width: 768px) { .app-layout::before { display: none; } }

/* ===== Admin Pages Mobile Polish ===== */
@media (max-width: 768px) {
    /* Users page */
    #status-toggle, #role-toggle { font-size: 0.625rem; }
    #status-toggle button, #role-toggle button { padding: 0.25rem 0.5rem; font-size: 0.625rem; }
    #search-input { width: 100% !important; }

    /* Permission modal - stack columns */
    .modal { width: 95%; max-height: 90vh; overflow-y: auto; }
    .modal[style*="max-width:720px"],
    .modal[style*="max-width:600px"] { max-width: 95% !important; }
    .modal [style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; min-height: auto !important; }
    .modal [style*="grid-template-columns:1fr 1fr"] > div:first-child { border-right: none !important; border-bottom: 1px solid var(--border); }

    /* Tables - hide less important columns */
    .users-hide-mobile { display: none; }
    .perm-item .perm-action { opacity: 1; }

    /* Settings page */
    .page-content[style*="max-width:500px"] { max-width: 100% !important; }

    /* Toggle groups wrap */
    .flex[style*="flex-wrap:wrap"] .toggle-group { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
    .header-title { font-size: 1rem; }
    .btn { font-size: 0.75rem; padding: 0.5rem 0.75rem; }
    .card-body { padding: 1rem; }
    .card-header { padding: 1rem; }
    .perm-item { padding: 0.5rem 0.75rem; margin: 0.125rem 0.25rem; }
    .perm-item .avatar { width: 24px; height: 24px; font-size: 0.5rem; }
    .perm-item .perm-action { opacity: 1; }
}

/* ===== Brand Travella and Partners — rollout completo (ago 2026) ===== */

/* Roboto per i numeri: cifre monospaziate, adatte a tabelle e KPI (brand manual §1.6) */
table, .text-4xl, .text-3xl, .text-2xl, .badge {
    font-family: 'Roboto', 'Albert Sans', sans-serif;
    font-variant-numeric: tabular-nums;
}

/* Sidebar navy (fronte biglietti da visita) — identica in light e dark */
.sidebar, .app-layout::before { background: var(--bg-sidebar); border-right-color: rgba(255,255,255,0.06); }
.sidebar-label { color: rgba(255,255,255,0.4); }
.sidebar-nav a { color: rgba(255,255,255,0.72); }
.sidebar-nav a:hover { color: #fff; background: rgba(255,255,255,0.08); }
.sidebar-nav a.active { color: #fff; background: rgba(51,126,156,0.45); }
.sidebar-footer button { color: rgba(255,255,255,0.72) !important; }
.sidebar-footer button:hover { color: #fff !important; }

/* Lockup testuale Travella and Partners al posto del logo immagine */
.tp-logo {
    font-family: 'Albert Sans', sans-serif;
    font-weight: 700;
    color: #fff;
    font-size: 1.3rem;
    line-height: 1.1;
    letter-spacing: -0.01em;
    text-align: left;
    padding: 0 1.5rem;
    white-space: nowrap;
}
.tp-logo .tp-and { font-size: 0.55em; font-weight: 400; margin-left: 0.3em; opacity: 0.85; }
.tp-badge {
    display: inline-block;
    font-size: 0.5em;
    font-weight: 700;
    border: 1.5px solid #fff;
    border-radius: 50%;
    width: 2em; height: 2em;
    line-height: 1.9em;
    text-align: center;
    vertical-align: super;
    margin-left: 0.35em;
}
.tp-mini { display: none; }
.sidebar.collapsed .tp-logo { display: none; }
.sidebar.collapsed .tp-mini {
    display: inline-block;
    font-family: 'Albert Sans', sans-serif;
    font-weight: 700;
    color: #fff;
    font-size: 0.8rem;
    border: 2px solid #fff;
    border-radius: 50%;
    width: 2.4em; height: 2.4em;
    line-height: 2.15em;
    text-align: center;
}

/* Hero card: gradiente navy -> teal come i biglietti da visita */
.card-hero { background: linear-gradient(135deg, #104552 0%, #337e9c 100%); }
.dark .badge-primary { background: rgba(51,126,156,0.3); color: #8fc0d3; }
