/* ==========================================================================
   APP.CSS — Tema unico Construction Management (mobile-first dark)
   Sostituisce: dashboard.css, dipendente.css, operaio.css, style.css
   ========================================================================== */

/* === RESET BASE ========================================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
    background: linear-gradient(135deg, var(--bg1) 0%, var(--bg2) 100%);
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}
img, svg { max-width: 100%; display: block; }
button { font: inherit; }

/* === DESIGN TOKENS ====================================================== */
:root {
    --text:        #e7ecff;
    --muted:       #9aa3b2;
    --accent:      #22d3ee;
    --accent2:     #3b82f6;
    --ok:          #10b981;
    --warn:        #f59e0b;
    --err:         #ef4444;
    --bg1:         #0f1320;
    --bg2:         #1a1f3a;
    --card1:       #11162a;
    --card2:       #1a1f3a;
    --border:      rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.18);
    --ring:        rgba(34, 211, 238, 0.35);
    --radius:      14px;
    --radius-sm:   10px;
    --shadow-md:   0 8px 24px rgba(0,0,0,.30);
    --shadow-lg:   0 12px 40px rgba(0,0,0,.45);

    /* Spacing scale */
    --gap-xs: 6px;
    --gap-sm: 10px;
    --gap:    16px;
    --gap-lg: 24px;
    --gap-xl: 32px;
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* === LAYOUT BASE ======================================================== */
.container, .wrap {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--gap);
}

/* === HEADER / NAVBAR ==================================================== */
.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(13, 18, 36, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.app-header-inner {
    max-width: 1500px;
    margin: 0 auto;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--gap);
}
.brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--accent);
    font-weight: 800;
    gap: 8px;
}
.brand img {
    height: 36px;
    width: auto;
    object-fit: contain;
}
.brand-text {
    font-size: 16px;
    letter-spacing: .2px;
}

/* Nav desktop */
.nav-links {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.nav-links a, .nav-btn {
    padding: 8px 12px;
    color: var(--text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    background: rgba(34, 211, 238, 0.08);
    border: 1px solid rgba(34, 211, 238, 0.20);
    font-weight: 600;
    font-size: 14px;
    transition: background .15s, transform .15s, box-shadow .15s;
    cursor: pointer;
    white-space: nowrap;
}
.nav-links a:hover, .nav-btn:hover {
    background: rgba(34, 211, 238, 0.16);
    transform: translateY(-1px);
}
.nav-links .nav-logout {
    background: rgba(239, 68, 68, 0.10);
    border-color: rgba(239, 68, 68, 0.30);
    color: #fecaca;
}
.nav-links .nav-logout:hover {
    background: rgba(239, 68, 68, 0.20);
}

/* Dropdown desktop */
.nav-item {
    position: relative;
}
.nav-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: linear-gradient(180deg, var(--card1), var(--card2));
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 6px;
    min-width: 240px;
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 60;
}
.nav-item.open .nav-dropdown { display: block; }
.nav-dropdown a {
    display: block;
    padding: 10px 12px;
    color: var(--text);
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    background: transparent;
    border: 0;
}
.nav-dropdown a:hover { background: rgba(34, 211, 238, 0.10); }

/* Hamburger mobile */
.menu-toggle {
    display: none;
    appearance: none;
    border: 1px solid rgba(34, 211, 238, 0.30);
    background: rgba(34, 211, 238, 0.10);
    color: var(--text);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    cursor: pointer;
}

/* Drawer mobile */
.drawer {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: 300px;
    max-width: 85vw;
    background: linear-gradient(135deg, var(--card1), var(--card2));
    border-right: 1px solid var(--border-strong);
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 1001;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
}
.drawer.open { transform: translateX(0); }
.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}
.drawer-close {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 22px;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 8px;
}
.drawer-close:hover { background: rgba(255,255,255,0.06); }
.drawer-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 4px;
}
.drawer-links a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    color: var(--text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    background: rgba(34, 211, 238, 0.06);
    border: 1px solid rgba(34, 211, 238, 0.15);
    font-weight: 600;
    font-size: 15px;
}
.drawer-links a:hover { background: rgba(34, 211, 238, 0.14); }
.drawer-group {
    list-style: none;
    margin-top: 10px;
}
.drawer-group-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    padding: 6px 10px;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.drawer-sub-links { list-style: none; padding: 0; margin: 0 0 0 6px; display: grid; gap: 4px; }

.backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1000;
    display: none;
}
.backdrop.show { display: block; }
body.no-scroll { overflow: hidden; }

@media (max-width: 899px) {
    .nav-links { display: none; }
    .menu-toggle { display: inline-flex; }
}

/* === CARDS ============================================================== */
.card {
    background: linear-gradient(180deg, var(--card1) 0%, var(--card2) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: var(--gap);
    box-shadow: var(--shadow-md);
}
.card h2 {
    margin: 0 0 12px;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card h3 { margin: 0 0 8px; font-size: 16px; }

.muted, .text-muted { color: var(--muted); font-size: 14px; }

/* === STATS GRID ========================================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--gap);
    margin-bottom: var(--gap);
}
.stat-card {
    background: linear-gradient(180deg, var(--card1), var(--card2));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    text-align: center;
    box-shadow: var(--shadow-md);
}
.stat-number {
    font-size: 1.8rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent2), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-top: 4px;
}

.stat {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
}
.stat .num { font-size: 1.4rem; font-weight: 800; }

/* === FORMS ============================================================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--gap);
    margin-bottom: var(--gap);
}
.form-group { display: flex; flex-direction: column; }

label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-sm);
    background: rgba(8, 12, 24, 0.65);
    color: var(--text);
    font-size: 15px;
    transition: border-color .15s, box-shadow .15s, background .15s;
    font-family: inherit;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--ring);
    background: rgba(12, 16, 32, 0.85);
}
textarea {
    min-height: 80px;
    resize: vertical;
}
input::placeholder, textarea::placeholder { color: rgba(154, 163, 178, 0.7); }

/* === BUTTONS ============================================================ */
.btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 18px;
    border: 0;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent2), var(--accent));
    color: #0b1024;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: .2px;
    cursor: pointer;
    text-decoration: none;
    transition: transform .1s, filter .15s, box-shadow .2s;
    text-align: center;
    min-height: 44px; /* touch target */
}
.btn:hover { filter: brightness(1.07); transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(34, 211, 238, 0.25); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; filter: grayscale(.3); }

.btn.btn-secondary { background: linear-gradient(135deg, #6b7280, #9ca3af); color: #0b1024; }
.btn.btn-success   { background: linear-gradient(135deg, var(--ok), #34d399); color: #0b1024; }
.btn.btn-warn      { background: linear-gradient(135deg, var(--warn), #fbbf24); color: #0b1024; }
.btn.btn-danger    { background: linear-gradient(135deg, var(--err), #f87171); color: #fff; }
.btn.btn-ghost {
    background: rgba(255,255,255,0.06);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn.btn-ghost:hover { background: rgba(255,255,255,0.12); }

.btn.sm { padding: 7px 12px; font-size: 13px; min-height: 36px; }
.btn.lg { padding: 14px 22px; font-size: 16px; min-height: 52px; }
.btn.btn-block { width: 100%; }

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: var(--gap);
}

/* === ALERTS ============================================================= */
.alert, .ok, .err {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: var(--gap);
    font-weight: 600;
    font-size: 14px;
    border: 1px solid;
}
.alert-success, .ok {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.40);
    color: #6ee7b7;
}
.alert-error, .err {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.40);
    color: #fecaca;
}
.alert-warn {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.40);
    color: #fcd34d;
}
.alert-info {
    background: rgba(34, 211, 238, 0.10);
    border-color: rgba(34, 211, 238, 0.30);
    color: var(--accent);
}

/* === TABLES ============================================================= */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.table, table.table, .table-wrap table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.table thead, .table-wrap table thead {
    background: rgba(8, 12, 24, 0.85);
}
.table th, .table-wrap table th {
    text-align: left;
    padding: 12px 14px;
    font-weight: 700;
    color: var(--accent);
    border-bottom: 1px solid var(--border-strong);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.table td, .table-wrap table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.table tr:hover td, .table-wrap table tr:hover td {
    background: rgba(255,255,255,0.03);
}

/* Mobile cards layout per le tabelle (data-label trick) */
@media (max-width: 640px) {
    .table-wrap table thead { display: none; }
    .table-wrap table tr {
        display: block;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        margin-bottom: 8px;
        background: rgba(255,255,255,0.02);
    }
    .table-wrap table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        border-bottom: 1px solid var(--border);
        padding: 10px 12px;
    }
    .table-wrap table tr td:last-child { border-bottom: 0; }
    .table-wrap table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--muted);
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: .3px;
    }
}

/* === BADGES ============================================================= */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: rgba(34, 211, 238, 0.18);
    color: var(--accent);
    border: 1px solid rgba(34, 211, 238, 0.40);
}
.badge-success { background: rgba(16, 185, 129, 0.18); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.45); }
.badge-warning { background: rgba(245, 158, 11, 0.18); color: #fcd34d; border-color: rgba(245, 158, 11, 0.45); }
.badge-error   { background: rgba(239, 68, 68, 0.18); color: #fecaca; border-color: rgba(239, 68, 68, 0.45); }
.badge-muted   { background: rgba(154, 163, 178, 0.18); color: var(--muted); border-color: var(--border-strong); }

/* === TABS =============================================================== */
.tabs {
    display: flex;
    gap: 6px;
    margin-bottom: var(--gap);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: thin;
}
.tabs .tab {
    appearance: none;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    color: var(--text);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
}
.tabs .tab:hover { background: rgba(34, 211, 238, 0.10); }
.tabs .tab.active {
    background: linear-gradient(135deg, var(--accent2), var(--accent));
    color: #0b1024;
    border-color: transparent;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* === GRID UTILITY ======================================================= */
.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* === EMPTY STATE ======================================================== */
.empty-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--muted);
}
.empty-state p { margin: 6px 0; }

/* === DIPENDENTE / OPERAIO SPECIFIC ====================================== */
.cantiere-section {
    margin: var(--gap) 0;
    border-left: 3px solid var(--accent);
    padding-left: var(--gap);
}
.cantiere-header {
    margin-bottom: var(--gap);
}
.dipendente-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
}

/* === PRESENZA / TIMBRATURA ============================================= */
.presenza-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: var(--radius);
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    margin-bottom: var(--gap);
}
.presenza-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 4px rgba(255,255,255,.06);
}
.presenza-dot.in  { background: var(--ok); box-shadow: 0 0 0 4px rgba(16,185,129,.30); animation: pulse 2s infinite; }
.presenza-dot.out { background: var(--muted); }

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(16,185,129,.30); }
    50%      { box-shadow: 0 0 0 8px rgba(16,185,129,.10); }
}

.presenza-label {
    font-weight: 700;
    font-size: 16px;
}
.presenza-meta { color: var(--muted); font-size: 13px; }

/* Bottoni timbra grandi */
.timbra-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: var(--gap);
}
.btn-timbra {
    min-height: 64px;
    font-size: 16px;
    font-weight: 800;
}
.btn-timbra-in  { background: linear-gradient(135deg, var(--ok), #34d399); color: #0b1024; }
.btn-timbra-out { background: linear-gradient(135deg, var(--err), #f87171); color: #fff; }

@media (max-width: 480px) {
    .timbra-buttons { grid-template-columns: 1fr; }
}

/* === STICKY ACTION BAR (mobile) ========================================= */
.sticky-bottom {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    background: rgba(13, 18, 36, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-strong);
    padding: 12px var(--gap) calc(12px + env(safe-area-inset-bottom));
    display: none;
    box-sizing: border-box;
    max-width: 100vw;
}
.sticky-bottom .timbra-buttons {
    margin: 0;
    gap: 8px;
    grid-template-columns: 1fr 1fr;
}
.sticky-bottom .btn-timbra {
    min-height: 56px;        /* leggermente più basso per la barra sticky */
    font-size: 15px;
    padding: 8px 12px;
}
@media (max-width: 768px) {
    .sticky-bottom { display: block; }
    /* Padding generoso per coprire bottoni 56px + 12+12 padding + safe-area */
    body.has-sticky-bottom { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
}

/* === HELPERS ============================================================ */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.flex-row    { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.flex-col    { display: flex; flex-direction: column; gap: 10px; }
.spacer      { flex: 1; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }

/* === LOGIN PAGES ======================================================== */
.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 16px;
}
.login-grid {
    width: 100%;
    max-width: 980px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
.login-brand {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #0f162f, #0c1228 60%, #0a1125);
    padding: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    box-shadow: var(--shadow-md), inset 0 0 0 1px rgba(255,255,255,.06);
}
.login-brand::after {
    content: "";
    position: absolute;
    inset: auto -20% -20% -20%;
    height: 55%;
    filter: blur(80px);
    background:
        radial-gradient(circle at 20% 0%, rgba(34,211,238,.30), transparent 60%),
        radial-gradient(circle at 80% 60%, rgba(59,130,246,.22), transparent 60%);
    pointer-events: none;
}
.login-brand-inner { position: relative; z-index: 1; text-align: center; max-width: 420px; }
.login-brand-inner img {
    width: 100%;
    height: auto;
    margin: 0 auto 12px;
    filter: drop-shadow(0 12px 28px rgba(34,211,238,.25));
}
.login-brand-caption { color: var(--muted); font-size: 14px; }

.login-card {
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--card1), var(--card2));
    padding: 28px;
    box-shadow: var(--shadow-md), inset 0 0 0 1px rgba(255,255,255,.06);
}
.login-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 8px;
    flex-wrap: wrap;
}
.login-card h1 {
    margin: 0 0 8px;
    font-size: 22px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.login-card form {
    display: grid;
    gap: 14px;
}
.login-card a { color: var(--accent); text-decoration: none; font-size: 13px; }
.login-card a:hover { text-decoration: underline; }
.login-footer {
    margin-top: 16px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

@media (max-width: 768px) {
    .login-grid { grid-template-columns: 1fr; }
    .login-brand { min-height: 180px; padding: 24px; }
}

/* === ROLE CHOOSER (index) =============================================== */
.role-list {
    display: grid;
    gap: 12px;
}
.role-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, rgba(34,211,238,.06), rgba(59,130,246,.06));
    border: 1px solid rgba(34,211,238,.20);
    text-decoration: none;
    color: var(--text);
    transition: transform .12s, background .15s, border-color .15s, box-shadow .15s;
}
.role-link:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, rgba(34,211,238,.14), rgba(59,130,246,.14));
    border-color: var(--accent);
    box-shadow: 0 10px 24px rgba(34,211,238,.20);
}
.role-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    font-size: 22px;
    background: rgba(34,211,238,.15);
    border: 1px solid rgba(34,211,238,.45);
}
.role-text { display: flex; flex-direction: column; }
.role-title { font-weight: 800; font-size: 16px; }
.role-desc { color: var(--muted); font-size: 13px; }

/* === FOCUS VISIBLE ====================================================== */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
button:focus-visible, .btn:focus-visible, a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

/* === SCROLLBAR ========================================================= */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.08);
    border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.16); }

/* === PRINT ============================================================== */
@media print {
    .app-header, .menu-toggle, .drawer, .sticky-bottom, .actions, .btn { display: none !important; }
    body { background: white; color: black; }
    .card { box-shadow: none; border-color: #ccc; background: white; color: black; }
}
.app-footer {
    margin-top: 40px;
    padding: 22px 16px;
    border-top: 1px solid rgba(255,255,255,.08);
    color: var(--muted);
    font-size: 13px;
}

.app-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.app-footer strong {
    color: var(--text);
    margin-right: 8px;
}

.app-footer-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.app-footer a {
    color: var(--muted);
    text-decoration: none;
}

.app-footer a:hover {
    color: var(--accent);
}
###
/* Header e menu sempre sopra alla mappa */
header,
.site-header,
.navbar,
.main-header {
    position: sticky;
    top: 0;
    z-index: 5000;
}

/* Dropdown/menu mobile sopra Leaflet */
nav,
.nav-menu,
.dropdown-menu,
.mobile-menu,
.user-menu,
.menu-dropdown,
.header-menu {
    position: relative;
    z-index: 6000;
}

/* Se il menu mobile è assoluto/fixed */
.nav-menu.open,
.mobile-menu.open,
.dropdown-menu.show,
.user-menu.show,
.header-menu.open {
    z-index: 7000;
}

/* La card della mappa non deve coprire il menu */
.card:has(#mappa-cantieri) {
    position: relative;
    z-index: 1;
}

/* Leaflet sotto all'header */
#mappa-cantieri {
    position: relative;
    z-index: 1;
}

/* Pannelli interni Leaflet */
#mappa-cantieri .leaflet-pane {
    z-index: 1;
}

#mappa-cantieri .leaflet-tile-pane {
    z-index: 1;
}

#mappa-cantieri .leaflet-overlay-pane {
    z-index: 2;
}

#mappa-cantieri .leaflet-marker-pane {
    z-index: 3;
}

#mappa-cantieri .leaflet-tooltip-pane {
    z-index: 4;
}

#mappa-cantieri .leaflet-popup-pane {
    z-index: 5;
}

#mappa-cantieri .leaflet-control-container {
    position: relative;
    z-index: 6;
}