:root {
    --bf: #1e40af;
    --bt: #3b82f6;
    --b: #3b82f6;
    --bl: #60a5fa;
    --bg: rgba(59, 130, 246, .15);
    --bgs: rgba(59, 130, 246, .4);
    --b20: rgba(59, 130, 246, .2);
    --b10: rgba(59, 130, 246, .1);
    --bb: rgba(59, 130, 246, .3)
}

[data-theme="green"] {
    --bf: #065f46;
    --bt: #10b981;
    --b: #10b981;
    --bl: #34d399;
    --bg: rgba(16, 185, 129, .15);
    --bgs: rgba(16, 185, 129, .4);
    --b20: rgba(16, 185, 129, .2);
    --b10: rgba(16, 185, 129, .1);
    --bb: rgba(16, 185, 129, .3)
}

[data-theme="orange"] {
    --bf: #92400e;
    --bt: #f59e0b;
    --b: #f59e0b;
    --bl: #fbbf24;
    --bg: rgba(245, 158, 11, .15);
    --bgs: rgba(245, 158, 11, .4);
    --b20: rgba(245, 158, 11, .2);
    --b10: rgba(245, 158, 11, .1);
    --bb: rgba(245, 158, 11, .3)
}

* {
    font-family: 'Inter', sans-serif
}

body {
    background: #0d0d0d;
    background-image: radial-gradient(ellipse at 20% 20%, rgba(59, 130, 246, .03) 0%, transparent 50%), radial-gradient(ellipse at 80% 80%, rgba(16, 185, 129, .03) 0%, transparent 50%), linear-gradient(rgba(255, 255, 255, .008) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .008) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px
}

.clock-mono {
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: .05em
}

::-webkit-scrollbar {
    width: 8px
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px
}

::-webkit-scrollbar-thumb:hover {
    background: #555
}

.glass {
    background: rgba(24, 24, 28, .95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 4px 24px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .03)
}

.glass-elevated {
    background: rgba(30, 30, 35, .98);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, .1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, .5), 0 0 0 1px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .05)
}

.section-card {
    background: rgba(18, 18, 22, .9);
    border: 1px solid rgba(255, 255, 255, .06);
    box-shadow: 0 2px 12px rgba(0, 0, 0, .3)
}

.section-inner {
    background: rgba(14, 14, 18, .95);
    border: 1px solid rgba(255, 255, 255, .04)
}

.btn-brand {
    background: linear-gradient(135deg, var(--bf), var(--bt));
    transition: all .2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .3)
}

.btn-brand:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--bgs), 0 2px 8px rgba(0, 0, 0, .4)
}

.btn-success {
    background: linear-gradient(135deg, #065f46, #10b981);
    transition: all .2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .3)
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(16, 185, 129, .4), 0 2px 8px rgba(0, 0, 0, .4)
}

.btn-danger {
    background: linear-gradient(135deg, #991b1b, #ef4444);
    transition: all .2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .3)
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(239, 68, 68, .4), 0 2px 8px rgba(0, 0, 0, .4)
}

.btn-press:active {
    transform: scale(.97) !important
}

.glow-b {
    box-shadow: 0 0 40px var(--bg), 0 4px 24px rgba(0, 0, 0, .4)
}

.logo-bg {
    background: linear-gradient(135deg, var(--bf), var(--bt));
    box-shadow: 0 2px 12px var(--bgs)
}

.b-txt {
    color: var(--b)
}

.b-bg {
    background: var(--b)
}

.b-bg20 {
    background: var(--b20)
}

.b-bdr {
    border-color: var(--bb)
}

.fade-in {
    animation: fi .3s ease-out
}

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

.slide-in {
    animation: si .35s ease-out forwards;
    opacity: 0
}

@keyframes si {
    from {
        opacity: 0;
        transform: translateX(-12px)
    }
    to {
        opacity: 1;
        transform: translateX(0)
    }
}

.pulse-d {
    animation: pd 2s infinite
}

@keyframes pd {
    0%, 100% {
        opacity: 1
    }
    50% {
        opacity: .5
    }
}

.code-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px
}

.tr-hover:hover {
    background: rgba(255, 255, 255, .03)
}

.leaflet-container {
    background: #0d0d0d;
    font-family: Inter, sans-serif
}

.leaflet-control-zoom {
    border: none !important
}

.leaflet-control-zoom a {
    background: #1a1a1f !important;
    color: #888 !important;
    border: 1px solid #2a2a30 !important
}

.leaflet-control-zoom a:hover {
    background: #2a2a30 !important;
    color: #fff !important
}

.leaflet-control-attribution {
    background: rgba(0, 0, 0, .6) !important;
    color: #444 !important;
    font-size: 9px
}

.leaflet-control-attribution a {
    color: #555 !important
}

.user-marker {
    background: #10b981;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(16, 185, 129, .6)
}

.office-marker {
    background: #3b82f6;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(59, 130, 246, .4)
}

.gps-off-marker {
    background: #ef4444;
    box-shadow: 0 0 15px rgba(239, 68, 68, .6)
}

.progress-bar {
    height: 6px;
    background: #1a1a1f;
    border-radius: 3px;
    overflow: hidden
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .3s
}

.progress-green {
    background: linear-gradient(90deg, #10b981, #34d399)
}

.progress-yellow {
    background: linear-gradient(90deg, #f59e0b, #fbbf24)
}

.progress-red {
    background: linear-gradient(90deg, #ef4444, #f87171)
}

.status-active {
    background: rgba(16, 185, 129, .15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, .3)
}

.status-inactive {
    background: rgba(107, 114, 128, .15);
    color: #9ca3af;
    border: 1px solid rgba(107, 114, 128, .3)
}

.status-expired {
    background: rgba(239, 68, 68, .15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, .3)
}

.input-dark {
    background: rgba(18, 18, 22, .95);
    border: 1px solid rgba(255, 255, 255, .1);
    transition: all .2s
}

.input-dark:focus {
    border-color: var(--bb);
    box-shadow: 0 0 0 2px var(--b10)
}

.header-bar {
    background: rgba(12, 12, 14, .98);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, .3)
}

/* Blocca scroll orizzontale globale (fix iPhone) */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}

.toggle-t {
    width: 56px;
    height: 28px;
    border-radius: 14px;
    position: relative;
    cursor: pointer;
    transition: background .2s;
    flex-shrink: 0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, .3)
}

.toggle-t.off {
    background: #2a2a2a
}

.toggle-t.on {
    background: var(--b, #10b981);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, .2), 0 0 12px var(--bgs)
}

.toggle-t::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .3)
}

.toggle-t.on::after {
    transform: translateX(28px)
}

.toggle-sm {
    width: 44px;
    height: 22px;
    border-radius: 11px;
    position: relative;
    cursor: pointer;
    transition: background .2s;
    flex-shrink: 0;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, .3)
}

.toggle-sm.off {
    background: #2a2a2a
}

.toggle-sm.on {
    background: var(--b, #10b981);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, .2), 0 0 8px var(--bgs)
}

.toggle-sm::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .3)
}

.toggle-sm.on::after {
    transform: translateX(22px)
}

.field-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    background: #1a1a1f;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    cursor: pointer;
    transition: all .2s
}

.field-tag:hover {
    background: #222228;
    border-color: rgba(255, 255, 255, .15)
}

.field-tag .code {
    color: #10b981
}

.field-tag .desc {
    color: #999;
    margin-left: 6px;
    font-size: 10px
}

.pcard {
    transition: all .3s;
    border: 1px solid rgba(255, 255, 255, .06);
    box-shadow: 0 4px 20px rgba(0, 0, 0, .3)
}

.pcard:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .4)
}

.lg {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(100px)
}

.sov {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .85);
    backdrop-filter: blur(8px)
}

.sov.on {
    display: flex
}

.sck {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: skp .5s cubic-bezier(.34, 1.56, .64, 1) forwards;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .5)
}

.sck.ing {
    background: rgba(16, 185, 129, .2);
    border: 4px solid #10b981;
    box-shadow: 0 0 40px rgba(16, 185, 129, .3), 0 8px 32px rgba(0, 0, 0, .5)
}

.sck.usc {
    background: rgba(239, 68, 68, .2);
    border: 4px solid #ef4444;
    box-shadow: 0 0 40px rgba(239, 68, 68, .3), 0 8px 32px rgba(0, 0, 0, .5)
}

@keyframes skp {
    0% {
        transform: scale(0);
        opacity: 0
    }
    100% {
        transform: scale(1);
        opacity: 1
    }
}

.sot {
    animation: stu .5s .2s ease-out both
}

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

.mp {
    animation: mpa 2s ease-in-out infinite;
    box-shadow: 0 4px 20px rgba(16, 185, 129, .3), 0 2px 8px rgba(0, 0, 0, .3)
}

@keyframes mpa {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(16, 185, 129, .3), 0 2px 8px rgba(0, 0, 0, .3)
    }
    50% {
        box-shadow: 0 4px 35px rgba(16, 185, 129, .5), 0 2px 8px rgba(0, 0, 0, .3)
    }
}

.ep {
    animation: epa 2s ease-in-out infinite;
    box-shadow: 0 4px 20px rgba(239, 68, 68, .3), 0 2px 8px rgba(0, 0, 0, .3)
}

@keyframes epa {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(239, 68, 68, .3), 0 2px 8px rgba(0, 0, 0, .3)
    }
    50% {
        box-shadow: 0 4px 35px rgba(239, 68, 68, .5), 0 2px 8px rgba(0, 0, 0, .3)
    }
}

.admin-map-container {
    height: 350px;
    width: 100%;
    border-radius: .75rem;
    overflow: hidden;
    z-index: 10
}

/* === NUOVI STILI HOMEPAGE === */
.role-card {
    background: rgba(20, 20, 26, .97);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 16px;
    transition: all .25s;
    cursor: pointer;
    overflow: hidden
}

.role-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, .15);
    box-shadow: 0 16px 48px rgba(0, 0, 0, .5)
}

.role-card .accent-bar {
    height: 3px;
    width: 100%
}

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

.portal-tab {
    padding: 8px 20px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    border: 1px solid transparent
}

.portal-tab.active {
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .12);
    color: #fff
}

.portal-tab.inactive {
    color: #6b7280
}

.portal-tab.inactive:hover {
    color: #9ca3af
}

.divider-line {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .08), transparent)
}

.emp-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(18, 18, 22, .9);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all .2s;
    font-size: 12px
}

.emp-chip:hover {
    background: rgba(30, 30, 38, .9);
    border-color: rgba(255, 255, 255, .14)
}

.emp-chip .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%
}

.section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #4b5563
}

.animate-stagger>* {
    opacity: 0;
    animation: fi .35s ease-out forwards
}

.animate-stagger>*:nth-child(1) {
    animation-delay: .05s
}

.animate-stagger>*:nth-child(2) {
    animation-delay: .1s
}

.animate-stagger>*:nth-child(3) {
    animation-delay: .15s
}

.animate-stagger>*:nth-child(4) {
    animation-delay: .2s
}

.animate-stagger>*:nth-child(5) {
    animation-delay: .25s
}

.animate-stagger>*:nth-child(6) {
    animation-delay: .3s
}

/* === SIDEBAR STYLES === */
.sidebar {
    background: linear-gradient(180deg, #0d0d0d 0%, #0a0a0d 100%);
}

.sa-nav-item, .ca-nav-item {
    color: #9ca3af;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sa-nav-item:hover, .ca-nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #e5e7eb;
}

.sa-nav-item.active, .ca-nav-item.active {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border-left: 3px solid #10b981;
    margin-left: -3px;
}

.sa-nav-item.active i, .ca-nav-item.active i {
    color: #10b981;
}

[data-theme="orange"] .sa-nav-item.active, 
[data-theme="orange"] .ca-nav-item.active {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border-left-color: #f59e0b;
}

[data-theme="orange"] .sa-nav-item.active i, 
[data-theme="orange"] .ca-nav-item.active i {
    color: #f59e0b;
}

[data-theme="blue"] .sa-nav-item.active, 
[data-theme="blue"] .ca-nav-item.active {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border-left-color: #3b82f6;
}

[data-theme="blue"] .sa-nav-item.active i, 
[data-theme="blue"] .ca-nav-item.active i {
    color: #3b82f6;
}

/* Sidebar section headers */
#ca-sidebar-header .company-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

#ca-sidebar-header .company-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    color: white;
}

#ca-sidebar-header .company-name {
    font-weight: 600;
    color: white;
    font-size: 14px;
    line-height: 1.2;
}

#ca-sidebar-header .company-id {
    font-size: 11px;
    color: #6b7280;
    font-family: 'JetBrains Mono', monospace;
}
/* ============================================================
   LOGIN FORM & ACCESSO RAPIDO — v0.4.4.6
   ============================================================ */

/* Input login focus accent */
#login-username:focus,
#login-password:focus {
    border-color: var(--bb);
    box-shadow: 0 0 0 2px rgba(var(--br), 0.15);
}

/* Shake animation for wrong credentials */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}
.shake { animation: shake 0.4s ease; }

/* Quick access panel */
#quick-panel-body { transition: max-height 0.25s ease; }
#quick-access-list button { transition: background 0.15s; }

/* emp-chip smaller variant for new landing */
.emp-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #12121a;
    border: 1px solid #2a2a30;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    white-space: nowrap;
}
.emp-chip:hover { border-color: #3a3a42; background: #1a1a22; }
.emp-chip .dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* Land stats compact row */
#land-stats { display: grid; grid-template-columns: repeat(3, 1fr); }

/* User management toggle */
.toggle-t.on, .toggle-t.off {
    position: relative;
    cursor: pointer;
}

/* ============================================================
   FIX v0.4.4.7 — Pannello accesso rapido più leggibile
   ============================================================ */
#quick-access-list button {
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #12121a;
    border: 1px solid #2a2a30;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
#quick-access-list button:hover {
    background: #1a1a24;
    border-color: #3a3a48;
}
#quick-access-list button p {
    margin: 0;
    line-height: 1.3;
}

/* Quick panel body scroll */
#quick-panel-body {
    overflow-y: auto;
}

/* ============================================================
   LOG ACCESSI / ATTIVITA / SCADENZE — v0.4.4.9
   ============================================================ */
#sa-log-access-list .glass-elevated,
#sa-log-activity-list .glass-elevated {
    transition: box-shadow 0.15s;
}
#sa-log-access-list .glass-elevated:hover,
#sa-log-activity-list .glass-elevated:hover {
    box-shadow: 0 0 0 1px rgba(255,255,255,0.06);
}

/* Backup drop zone */
#backup-file-input + div:hover {
    border-color: rgba(59,130,246,0.5);
}

/* Nota backup info */
code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75em;
    background: rgba(255,255,255,0.07);
    padding: 1px 5px;
    border-radius: 4px;
}

/* Expiry badge urgente */
.expiry-urgent  { color: #f87171; background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.25); }
.expiry-warning { color: #fbbf24; background: rgba(245,158,11,0.12); border-color: rgba(245,158,11,0.25); }

/* ============================================================
   FORMATO ACQUISIZIONE — pannello inline v0.4.5.0
   ============================================================ */
.token-pill:hover .font-mono {
    background: var(--b10);
}
.token-pill .font-mono {
    transition: background 0.15s;
}
code.text-b {
    color: var(--b);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75em;
    background: rgba(var(--br), 0.12);
    padding: 1px 5px;
    border-radius: 4px;
}

/* Tracciato chr counter pill */
#tr-inline-chrcount {
    font-family: 'JetBrains Mono', monospace;
    transition: color 0.2s;
}

/* Input tracking monospace */
#tr-inline-template {
    letter-spacing: 0.03em;
}

/* ============================================================
   DASHBOARD TRANSITI — v0.4.5.1
   ============================================================ */
#ca-transit-widget > div {
    transition: box-shadow 0.2s;
}
#ca-transit-table table {
    min-width: 550px;
}

/* Three-button tracciato actions row */
#ca-tracciato-preview .flex.gap-3 button {
    min-width: 0;
}

/* ============================================================
   PANNELLO DISPOSITIVI — v0.4.5.3
   ============================================================ */
#ca-devices details summary::-webkit-details-marker { display: none; }
#ca-devices details[open] summary i[data-lucide="chevron-down"] {
    transform: rotate(180deg);
}
#ca-devices details summary i { transition: transform 0.2s; }

.btn-device-gen {
    white-space: nowrap;
}
#ca-devices-list > div {
    transition: background 0.12s;
}

/* ============================================================
   PWA + RESPONSIVE SIDEBAR — v0.4.5.4
   ============================================================ */

/* Safe area insets (iPhone notch / home indicator) */
body {
    padding-bottom: env(safe-area-inset-bottom);
}
.header-bar {
    padding-top: env(safe-area-inset-top);
    /* Contiene tutto il contenuto dentro la viewport su iPhone */
    box-sizing: border-box;
    width: 100%;
}

/* Sidebar: desktop always visible, mobile slide-in */
.sidebar-panel {
    transition: transform 0.25s cubic-bezier(.4,0,.2,1);
}

/* Mobile: sidebar hidden off-screen by default */
@media (max-width: 767px) {
    .sidebar-panel {
        transform: translateX(-100%);
        box-shadow: 4px 0 24px rgba(0,0,0,.5);
    }
    .sidebar-panel.open {
        transform: translateX(0);
    }
    /* Main content: full width on mobile (no ml-64 offset) */
    #p-sa main,
    #p-ca main {
        margin-left: 0 !important;
        padding: 16px !important;
    }
    /* Employee panel: full width */
    #p-em {
        max-width: 100%;
        padding-left: 16px;
        padding-right: 16px;
    }
    /* Header hamburger visible on mobile */
    #sidebar-toggle {
        display: flex !important;
    }
    /* Landing: stack layout */
    #pg-land .grid-cols-2 {
        grid-template-columns: 1fr;
    }
    /* Transit table scroll */
    #ca-transit-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    /* Stamp button area padding for home indicator */
    .stamp-btn-area {
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
}

/* Sidebar overlay (dark backdrop on mobile) */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 39;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

/* Desktop: sidebar always visible, no toggle needed */
@media (min-width: 768px) {
    .sidebar-panel {
        transform: translateX(0) !important;
    }
    .sidebar-overlay {
        display: none !important;
    }
    #sidebar-toggle {
        display: none !important;
    }
}

/* Touch targets: min 44px for mobile (WCAG AA) */
@media (max-width: 767px) {
    .sa-nav-item,
    .ca-nav-item,
    .btn-press {
        min-height: 44px;
    }
    .emp-chip {
        min-height: 40px;
        padding: 6px 12px;
    }
}

/* PWA install banner safe area */
#pwa-install-banner > div {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

/* Scrollbar thin on mobile */
@media (max-width: 767px) {
    ::-webkit-scrollbar { width: 4px; height: 4px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }
}

/* Font size scaling */
@media (max-width: 360px) {
    html { font-size: 14px; }
}

/* ============================================================
   SA POLICY PANEL — v0.4.5.5
   ============================================================ */
.policy-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid #2a2a30;
    background: #12121a;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s;
}
.policy-btn:hover { border-color: #3a3a40; color: #d1d5db; }
.policy-btn-active {
    background: rgba(99,102,241,0.15);
    border-color: rgba(99,102,241,0.4);
    color: #a5b4fc;
}
.policy-btn-on {
    background: rgba(16,185,129,0.15);
    border-color: rgba(16,185,129,0.4);
    color: #34d399;
}
.policy-btn-off {
    background: rgba(239,68,68,0.1);
    border-color: rgba(239,68,68,0.3);
    color: #f87171;
}

/* Locked toggle indicator */
.toggle-t.pointer-events-none {
    filter: grayscale(0.5);
}

/* Map style selector */
#map-style-selector {
    background: #1a1a1f !important;
    color: #fff !important;
    border: 1px solid #2a2a30 !important;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: all 0.2s;
}
#map-style-selector:hover {
    background: #252529 !important;
    border-color: var(--bb) !important;
}
#map-style-selector:focus {
    outline: none;
    border-color: var(--b) !important;
    box-shadow: 0 0 0 2px var(--b10);
}
#map-style-selector option {
    background: #1a1a1f;
    color: #fff;
    padding: 8px;
}
