/* ============================================
   SECURITY PORTAL - MINIMAL BLACK & YELLOW
   Modern, Premium Design System
   ============================================ */

/* ============================================
   CSS VARIABLES - DESIGN TOKENS
   ============================================ */
:root {
    /* Primary Colors - Pure Black & Vibrant Yellow */
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-card: #111111;
    --bg-elevated: #1a1a1a;
    --bg-glass: rgba(20, 20, 20, 0.85);
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #666666;
    
    /* Accent - Yellow Palette */
    --accent: #f5c518;
    --accent-light: #ffe066;
    --accent-dark: #d4a617;
    --accent-glow: rgba(245, 197, 24, 0.35);
    --accent-subtle: rgba(245, 197, 24, 0.08);
    --accent-border: rgba(245, 197, 24, 0.2);
    
    /* Semantic Colors */
    --green: #22c55e;
    --green-bg: rgba(34, 197, 94, 0.12);
    --red: #ef4444;
    --red-bg: rgba(239, 68, 68, 0.12);
    --blue: #3b82f6;
    --blue-bg: rgba(59, 130, 246, 0.12);
    
    /* Borders & Shadows */
    --border: rgba(255, 255, 255, 0.06);
    --border-accent: rgba(245, 197, 24, 0.25);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-accent: 0 4px 24px rgba(245, 197, 24, 0.25);
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Safe Areas */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ============================================
   CSS RESET & BASE STYLES
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    line-height: 1.5;
}

/* Subtle grid pattern background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: 
        linear-gradient(rgba(245, 197, 24, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(245, 197, 24, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: -1;
}

/* ============================================
   LOGIN SCREEN
   ============================================ */
.login-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.login-screen.active {
    display: flex;
}

.login-screen::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at center, rgba(245, 197, 24, 0.05) 0%, transparent 50%);
    animation: pulse-glow 8s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

.login-container {
    position: relative;
    width: 100%;
    max-width: 380px;
    padding: var(--space-xl);
    text-align: center;
    z-index: 1;
}

.login-logo {
    margin-bottom: var(--space-xl);
}

.login-logo svg {
    filter: drop-shadow(0 0 30px var(--accent-glow));
}

.login-logo svg rect {
    fill: var(--accent);
}

.login-logo svg text {
    fill: var(--bg-primary);
    font-weight: 700;
}

.login-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-xs);
    background: linear-gradient(135deg, var(--text-primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: var(--space-xl);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.btn-login {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn-login::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.btn-login:hover {
    background: var(--accent-light);
    box-shadow: var(--shadow-accent);
    transform: translateY(-2px);
}

.btn-login:hover::before {
    transform: translateX(100%);
}

.btn-login:active {
    transform: translateY(0);
}

.login-error {
    color: var(--red);
    font-size: 0.875rem;
    margin-top: var(--space-md);
    min-height: 1.5em;
}

/* Remember Me */
.remember-me {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    cursor: pointer;
    margin-bottom: var(--space-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.remember-me input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ============================================
   MAIN APP LAYOUT
   ============================================ */
.app {
    min-height: 100vh;
    padding-bottom: 100px;
}

.status-bar {
    height: var(--safe-top);
    background: var(--bg-primary);
}

/* ============================================
   HEADER
   ============================================ */
.header {
    padding: var(--space-lg);
    padding-top: calc(var(--space-lg) + var(--safe-top));
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.greeting-time {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.greeting-name {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-top: var(--space-xs);
}

.avatar-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.avatar-btn:hover .avatar {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

.avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--accent);
    transition: var(--transition);
}

.user-role {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--accent);
    margin-top: 4px;
    letter-spacing: 0.1em;
    font-weight: 500;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main {
    padding: 0 var(--space-lg);
}

/* ============================================
   STATS SECTION
   ============================================ */
.stats-section {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    border: 1px solid var(--border);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-border), transparent);
    opacity: 0;
    transition: var(--transition);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card.primary {
    background: linear-gradient(135deg, var(--accent-subtle), transparent);
    border-color: var(--border-accent);
}

.stat-card.primary::before {
    opacity: 1;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 28px;
    height: 28px;
    stroke: var(--accent);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: var(--space-xs);
}

/* ============================================
   SECTION TITLE
   ============================================ */
.section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-md);
}

/* ============================================
   ACTION GRID
   ============================================ */
.actions-section {
    margin-bottom: var(--space-xl);
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
}

.action-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg) var(--space-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.action-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, var(--accent-subtle), transparent 70%);
    opacity: 0;
    transition: var(--transition);
}

.action-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-4px);
}

.action-card:hover::before {
    opacity: 1;
}

.action-card:active {
    transform: scale(0.98) translateY(-2px);
}

.action-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.action-icon svg {
    width: 32px;
    height: 32px;
    transition: var(--transition);
}

.action-icon.green {
    background: var(--green-bg);
}
.action-icon.green svg {
    stroke: var(--green);
}

.action-icon.red {
    background: var(--red-bg);
}
.action-icon.red svg {
    stroke: var(--red);
}

.action-icon.blue {
    background: var(--accent-subtle);
}
.action-icon.blue svg {
    stroke: var(--accent);
}

.action-icon.purple {
    background: var(--accent-subtle);
}
.action-icon.purple svg {
    stroke: var(--accent);
}

.action-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    position: relative;
    z-index: 1;
}

/* ============================================
   ACTIVITY SECTION
   ============================================ */
.activity-section {
    margin-bottom: var(--space-xl);
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.activity-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.activity-item:hover {
    background: var(--bg-elevated);
    border-color: var(--border-accent);
}

.activity-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.activity-indicator.checkin {
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
}

.activity-indicator.checkout {
    background: var(--red);
    box-shadow: 0 0 8px var(--red);
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-name {
    display: block;
    font-weight: 500;
    font-size: 1rem;
}

.activity-detail {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.activity-company {
    display: block;
    font-size: 0.8rem;
    color: var(--accent);
    margin-top: 2px;
    font-weight: 500;
}

.activity-details-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-top: var(--space-xs);
    align-items: center;
}

.activity-detail {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.activity-entry-type {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-elevated);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.activity-plate {
    font-size: 0.75rem;
    color: var(--accent);
    background: var(--accent-subtle);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    letter-spacing: 0.05em;
}

.activity-empty {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
}

/* ============================================
   BOTTOM NAVIGATION
   ============================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(70px + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-sm);
    transition: var(--transition);
    position: relative;
}

.nav-item svg {
    width: 26px;
    height: 26px;
    transition: var(--transition);
}

.nav-item span {
    font-size: 0.65rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item.active {
    color: var(--accent);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
}

.nav-item.fab {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--bg-primary);
    margin-top: -24px;
    box-shadow: var(--shadow-accent);
    transition: var(--transition);
}

.nav-item.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 32px var(--accent-glow);
}

.nav-item.fab svg {
    width: 30px;
    height: 30px;
}

.nav-item.fab span {
    display: none;
}

/* ============================================
   MODALS
   ============================================ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
}

.modal.active {
    display: block;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 90vh;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--space-lg);
    padding-bottom: calc(var(--space-lg) + var(--safe-bottom));
    overflow-y: auto;
    animation: slideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border-top: 1px solid var(--border-accent);
}

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

.modal-handle {
    width: 40px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 2px;
    margin: 0 auto var(--space-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.modal-header h2 {
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-elevated);
    border-color: var(--border-accent);
    color: var(--accent);
}

.modal-dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-card);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    text-align: center;
    min-width: 300px;
    border: 1px solid var(--border);
    animation: scaleIn 0.25s ease;
}

@keyframes scaleIn {
    from {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.modal-dialog h3 {
    margin-bottom: var(--space-sm);
    font-size: 1.25rem;
}

.modal-dialog p {
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

.modal-actions {
    display: flex;
    gap: var(--space-sm);
}

.btn-cancel,
.btn-confirm {
    flex: 1;
    padding: var(--space-md);
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
}

.btn-cancel {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-cancel:hover {
    background: var(--bg-card);
}

.btn-confirm {
    background: var(--accent);
    color: var(--bg-primary);
}

.btn-confirm:hover {
    background: var(--accent-light);
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

textarea.form-input {
    resize: none;
    min-height: 100px;
}

/* ============================================
   RADIO GRID
   ============================================ */
.radio-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
}

.radio-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.radio-card {
    position: relative;
    cursor: pointer;
}

.radio-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.radio-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.radio-card input:checked + .radio-content {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.radio-icon {
    font-size: 1.75rem;
}

.radio-text {
    font-size: 0.8rem;
    margin-top: var(--space-sm);
    color: var(--text-secondary);
    font-weight: 500;
}

.radio-card input:checked + .radio-content .radio-text {
    color: var(--accent);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-submit {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
    transition: var(--transition);
}

.btn-submit:hover {
    background: var(--accent-light);
    box-shadow: var(--shadow-accent);
    transform: translateY(-2px);
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-submit svg {
    width: 20px;
    height: 20px;
}

.btn-new-visitor {
    width: 100%;
    padding: var(--space-md);
    background: transparent;
    border: 1px dashed var(--border-accent);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    transition: var(--transition);
    font-size: 1rem;
}

.btn-new-visitor:hover {
    background: var(--accent-subtle);
    border-style: solid;
}

.btn-new-visitor svg {
    width: 20px;
    height: 20px;
    stroke: var(--accent);
}

/* ============================================
   SEARCH BOX
   ============================================ */
.search-box {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: var(--accent);
}

.search-box svg {
    width: 22px;
    height: 22px;
    stroke: var(--text-muted);
    flex-shrink: 0;
}

.search-box input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box input:focus {
    outline: none;
}

/* ============================================
   SELECT LIST
   ============================================ */
.select-list {
    max-height: 300px;
    overflow-y: auto;
}

.select-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    cursor: pointer;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.select-item:hover {
    background: var(--bg-elevated);
    border-color: var(--border-accent);
}

.select-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--accent);
}

.select-info {
    flex: 1;
}

.select-name {
    display: block;
    font-weight: 500;
    font-size: 1rem;
}

.select-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.select-badge {
    font-size: 0.7rem;
    padding: 4px 10px;
    background: var(--green-bg);
    color: var(--green);
    border-radius: var(--radius-full);
    font-weight: 500;
}

.select-empty {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
}

.modal-divider {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: var(--space-lg) 0;
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.modal-divider::before,
.modal-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ============================================
   CHECKIN VISITOR
   ============================================ */
.checkin-visitor {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-xl);
    border: 1px solid var(--border-accent);
}

.checkin-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.5rem;
    color: var(--bg-primary);
}

.checkin-name {
    display: block;
    font-weight: 600;
    font-size: 1.25rem;
}

.checkin-company {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ============================================
   VIEWS
   ============================================ */
.view-content {
    display: none;
}

.view-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.view-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-lg);
}

/* ============================================
   VISITOR CARDS
   ============================================ */
.visitors-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.visitor-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.visitor-card.present {
    border-color: var(--green);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.05), transparent);
}

.visitor-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.visitor-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--accent);
}

.visitor-info {
    flex: 1;
}

.visitor-name {
    display: block;
    font-weight: 600;
    font-size: 1.1rem;
}

.visitor-company {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.visitor-status {
    font-size: 0.7rem;
    padding: 4px 10px;
    background: var(--green-bg);
    color: var(--green);
    border-radius: var(--radius-full);
    font-weight: 500;
}

.visitor-actions {
    display: flex;
    gap: var(--space-sm);
}

.btn-checkin,
.btn-checkout {
    flex: 1;
    padding: var(--space-md);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
}

.btn-checkin {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid var(--green);
}

.btn-checkin:hover {
    background: var(--green);
    color: var(--bg-primary);
}

.btn-checkout {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid var(--red);
}

.btn-checkout:hover {
    background: var(--red);
    color: white;
}

/* ============================================
   HISTORY
   ============================================ */
.history-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.history-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.history-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.history-icon.complete {
    background: var(--green-bg);
    color: var(--green);
}

.history-icon.active {
    background: var(--accent-subtle);
    color: var(--accent);
}

.history-content {
    flex: 1;
}

.history-name {
    display: block;
    font-weight: 500;
    font-size: 1rem;
}

.history-detail {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.history-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ============================================
   EMPTY VIEW
   ============================================ */
.empty-view {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3.5rem;
    display: block;
    margin-bottom: var(--space-md);
}

/* ============================================
   LOADING
   ============================================ */
.loading {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
}

/* ============================================
   USER MENU
   ============================================ */
.user-menu {
    position: fixed;
    top: 90px;
    right: var(--space-lg);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    min-width: 200px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
    border: 1px solid var(--border);
    animation: scaleIn 0.2s ease;
}

.user-menu.active {
    display: block;
}

.user-menu-item {
    padding: var(--space-md);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.95rem;
    transition: var(--transition);
}

.user-menu-item:hover {
    background: var(--bg-elevated);
}

.user-menu-item.danger {
    color: var(--red);
}

.user-menu-divider {
    height: 1px;
    background: var(--border);
    margin: var(--space-xs) 0;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    top: calc(var(--space-lg) + var(--safe-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    transition: var(--transition);
}

.toast.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.toast-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    background: var(--green-bg);
    color: var(--green);
}

.toast.error .toast-icon {
    background: var(--red-bg);
    color: var(--red);
}

.toast.warning .toast-icon {
    background: var(--accent-subtle);
    color: var(--accent);
}

.toast.info .toast-icon {
    background: var(--blue-bg);
    color: var(--blue);
}

.toast-message {
    font-size: 0.95rem;
    font-weight: 500;
}

/* ============================================
   DELETE BUTTON
   ============================================ */
.btn-delete {
    padding: var(--space-md);
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid var(--red);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
}

.btn-delete:hover {
    background: var(--red);
    color: white;
}

/* ============================================
   SETTINGS & ALARM
   ============================================ */
.settings-section {
    padding: var(--space-md) 0;
}

.settings-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.settings-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--space-xl);
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
}

.toggle-switch input {
    display: none;
}

.toggle-switch label {
    display: flex;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    border: 1px solid var(--border);
}

.toggle-switch span {
    padding: var(--space-md) var(--space-lg);
    transition: var(--transition);
    font-weight: 500;
}

.toggle-off,
.toggle-on {
    color: var(--text-muted);
}

.toggle-switch input:not(:checked) + label .toggle-off {
    background: var(--red-bg);
    color: var(--red);
}

.toggle-switch input:checked + label .toggle-on {
    background: var(--green-bg);
    color: var(--green);
}

/* Interval Selector */
.interval-selector {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.interval-btn {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--accent);
    font-size: 1.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.interval-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--border-accent);
}

.interval-value {
    font-size: 2.5rem;
    font-weight: 700;
    min-width: 80px;
    text-align: center;
    color: var(--accent);
}

/* ============================================
   ALARM OVERLAY
   ============================================ */
.alarm-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, var(--red), #dc2626);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: alarm-pulse 0.5s ease infinite alternate;
}

.alarm-overlay.active {
    display: flex;
}

@keyframes alarm-pulse {
    from { background: linear-gradient(135deg, var(--red), #dc2626); }
    to { background: linear-gradient(135deg, #dc2626, #b91c1c); }
}

.alarm-content {
    text-align: center;
    color: white;
    padding: var(--space-xl);
}

.alarm-icon {
    font-size: 6rem;
    animation: shake 0.3s ease infinite;
}

@keyframes shake {
    0%, 100% { transform: translateX(0) rotate(0); }
    25% { transform: translateX(-8px) rotate(-5deg); }
    75% { transform: translateX(8px) rotate(5deg); }
}

.alarm-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: var(--space-xl) 0 var(--space-sm);
    letter-spacing: 0.05em;
}

.alarm-content p {
    opacity: 0.9;
    margin-bottom: var(--space-xl);
    font-size: 1.1rem;
}

.alarm-dismiss {
    padding: var(--space-lg) var(--space-2xl);
    background: white;
    color: var(--red);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1.25rem;
    font-weight: 700;
    cursor: pointer;
    animation: bounce 0.6s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ============================================
   ALARM COUNTDOWN
   ============================================ */
.alarm-icon-stat {
    background: var(--accent-subtle) !important;
}

.alarm-icon-stat svg {
    stroke: var(--accent) !important;
}

.stat-value.countdown {
    font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
    color: var(--accent) !important;
}

#alarmCountdownCard .stat-label {
    color: var(--accent);
}

/* ============================================
   ROUNDS (RONDE) STYLES
   ============================================ */
.rounds-start {
    text-align: center;
    padding: var(--space-2xl) 0;
}

.rounds-info {
    margin-bottom: var(--space-xl);
    color: var(--text-secondary);
}

.rounds-info p {
    font-size: 1.1rem;
}

.btn-start-round {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark)) !important;
    color: var(--bg-primary) !important;
    font-size: 1.2rem !important;
    padding: var(--space-lg) var(--space-xl) !important;
    box-shadow: var(--shadow-accent);
}

.btn-start-round:hover {
    background: linear-gradient(135deg, var(--accent-light), var(--accent)) !important;
}

.btn-complete-round {
    background: linear-gradient(135deg, var(--green), #16a34a) !important;
    font-size: 1.15rem !important;
    padding: var(--space-lg) !important;
    margin-top: var(--space-xl);
}

.round-progress {
    text-align: center;
    padding: var(--space-xl);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-xl);
    border: 1px solid var(--border-accent);
}

.round-progress span:first-child {
    display: block;
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.02em;
}

.round-progress span:last-child {
    color: var(--text-secondary);
}

.checkpoints-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.checkpoint-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid var(--border);
}

.checkpoint-item:not(.completed):hover {
    background: var(--bg-elevated);
    border-color: var(--accent);
}

.checkpoint-item.completed {
    background: var(--green-bg);
    border-color: var(--green);
    cursor: default;
}

.checkpoint-icon {
    font-size: 2rem;
}

.checkpoint-name {
    font-size: 1.1rem;
    font-weight: 500;
}

.checkpoint-item.completed .checkpoint-name {
    color: var(--green);
}

.rounds-history {
    margin-top: var(--space-2xl);
}

/* ============================================
   CHECKPOINT MODAL STYLES
   ============================================ */
.checkpoint-report-info {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
    border: 1px solid var(--border);
}

.report-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border);
}

.report-row:last-child {
    border-bottom: none;
}

.report-label {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.report-value {
    font-weight: 600;
    font-size: 0.95rem;
}

.camera-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.btn-camera {
    width: 100%;
    padding: var(--space-lg);
    background: var(--bg-card);
    border: 2px dashed var(--accent);
    border-radius: var(--radius-md);
    color: var(--accent);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-camera:hover {
    background: var(--accent-subtle);
    border-style: solid;
}

.photo-preview {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.photo-preview img {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: var(--radius-md);
}

.btn-remove-photo {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--red);
    color: white;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
}

.checkpoint-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-top: var(--space-xl);
}

.btn-checkpoint-ok {
    width: 100%;
    padding: var(--space-lg);
    background: linear-gradient(135deg, var(--green), #16a34a);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-checkpoint-ok:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.3);
}

.btn-checkpoint-issue {
    width: 100%;
    padding: var(--space-lg);
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: var(--bg-primary);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-checkpoint-issue:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-accent);
}

/* ============================================
   ROUND DETAILS & PHOTO STYLES
   ============================================ */
.round-item {
    cursor: pointer;
}

.btn-delete-small {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid var(--red);
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
    font-size: 0.85rem;
    cursor: pointer;
    margin-left: auto;
    transition: var(--transition);
}

.btn-delete-small:hover {
    background: var(--red);
    color: white;
}

.checkpoints-detail-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.checkpoint-detail-item {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    border-left: 4px solid var(--green);
}

.checkpoint-detail-item.issue {
    border-left-color: var(--accent);
    background: var(--accent-subtle);
}

.checkpoint-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.checkpoint-time {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.checkpoint-notes {
    color: var(--text-secondary);
    font-size: 0.95rem;
    padding: var(--space-sm) 0;
    line-height: 1.5;
}

.checkpoint-photo {
    margin-top: var(--space-sm);
}

.checkpoint-photo img {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.checkpoint-photo img:hover {
    transform: scale(1.02);
}

/* Full Photo Modal */
.photo-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-modal-content {
    text-align: center;
    padding: var(--space-lg);
}

.photo-modal-content img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: var(--radius-md);
}

.photo-modal-content p {
    color: var(--text-muted);
    margin-top: var(--space-md);
}

/* Photo Badge */
.photo-badge {
    display: inline-block;
    background: var(--accent-subtle);
    color: var(--accent);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    margin-left: 8px;
    font-weight: 500;
}

/* No Photo Message */
.no-photo {
    color: var(--text-muted);
    font-style: italic;
    padding: var(--space-sm) 0;
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 400px) {
    .action-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .radio-grid.cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .login-container {
        max-width: 420px;
    }
    
    .main {
        max-width: 640px;
        margin: 0 auto;
    }
    
    .header {
        max-width: 700px;
        margin: 0 auto;
    }
}

/* ============================================
   ADMIN REPORTS SECTION
   ============================================ */
.admin-reports-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    border: 1px solid var(--border-accent);
}

.reports-header {
    margin-bottom: var(--space-lg);
}

.reports-header h3 {
    color: var(--accent);
    font-size: 1.1rem;
    font-weight: 600;
}

.reports-filters {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.custom-date-range {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.report-output {
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border);
}

.report-actions {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.btn-print, .btn-export {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-print:hover, .btn-export:hover {
    background: var(--bg-glass);
    border-color: var(--accent);
}

.report-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
}

.report-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: var(--space-sm);
    text-align: center;
}

.report-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: var(--space-lg);
}

.report-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.report-stat {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    text-align: center;
}

.report-stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
    display: block;
}

.report-stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: var(--space-md);
}

.report-table th {
    background: var(--bg-card);
    color: var(--accent);
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.report-table td {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.report-table tr:hover td {
    background: var(--bg-elevated);
}

.report-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: var(--space-lg);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-accent);
}

.report-empty {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-muted);
}

@media print {
    body { background: white; color: black; }
    .admin-reports-section { border: none; padding: 0; }
    .reports-filters, .report-actions, .bottom-nav, .header { display: none !important; }
    .report-content { background: white; padding: 0; }
    .report-title, .report-stat-value { color: black; }
    .report-table th { background: #f0f0f0; color: black; }
}

/* ============================================
   OPERATORE IN TURNO - CLOCK IN/OUT
   ============================================ */
.operator-shift-section {
    margin-bottom: var(--space-lg);
}

.operator-shift-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 1px solid var(--border);
}

.no-operator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    text-align: center;
}

.no-operator-icon {
    font-size: 2.5rem;
    opacity: 0.5;
}

.no-operator-text {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.btn-clock-in {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border: none;
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}

.btn-clock-in:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
}

.operator-on-duty {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
}

.operator-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.operator-badge {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.operator-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.operator-since {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.btn-clock-out {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-clock-out:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

/* Badge operatore nelle ronde */
.rounds-operator-badge {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    border-left: 3px solid var(--green);
}

.rounds-operator-badge .badge-icon {
    font-size: 1.2rem;
}

.rounds-operator-badge .badge-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.rounds-operator-badge strong {
    color: var(--accent);
}

/* ============================================
   ADMIN - GESTIONE OPERATORI
   ============================================ */
.admin-operators-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    border: 1px solid var(--border-accent);
}

.operators-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.operators-header h3 {
    color: var(--accent);
    font-size: 1.1rem;
    font-weight: 600;
}

.btn-add-operator {
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-add-operator:hover {
    background: var(--accent-light);
}

.operators-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.operator-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.operator-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.operator-item-name {
    font-weight: 600;
    color: var(--text-primary);
}

.operator-item-phone {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.operator-item-status {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-weight: 600;
}

.operator-item-status.on-duty {
    background: var(--green-bg);
    color: var(--green);
}

.operator-item-status.off-duty {
    background: var(--bg-elevated);
    color: var(--text-muted);
}

.btn-delete-operator {
    background: var(--red-bg);
    color: var(--red);
    border: none;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-delete-operator:hover {
    background: var(--red);
    color: white;
}

/* Storico turni */
.shifts-history {
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border);
}

.shifts-history h4 {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--space-md);
}

.shifts-history-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 300px;
    overflow-y: auto;
}

.shift-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.shift-item-operator {
    font-weight: 600;
    color: var(--text-primary);
}

.shift-item-time {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.shift-item-duration {
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
}

/* Modal description */
.modal-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--space-lg);
    text-align: center;
}

.btn-clock-in-confirm {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
}

/* ============================================
   FLOATING REFRESH BUTTON
   ============================================ */
.floating-refresh-btn {
    position: fixed;
    bottom: 100px;
    left: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    z-index: 100;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.floating-refresh-btn:hover {
    background: var(--accent);
    color: var(--bg-primary);
    transform: scale(1.1);
}

.floating-refresh-btn:active {
    transform: scale(0.95);
}

.floating-refresh-btn svg {
    width: 24px;
    height: 24px;
}

.floating-refresh-btn.spinning svg {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ============================================
   ROUND HISTORY - VIEW DETAILS BUTTON
   ============================================ */
.round-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.round-actions .history-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.btn-view-details {
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    border-radius: var(--radius-md);
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-view-details:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.btn-view-details:active {
    transform: scale(0.95);
}

.round-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.round-item .history-content {
    flex: 1;
    min-width: 0;
}

/* ============================================
   CLOCK-IN CHECKLIST
   ============================================ */
.modal-sheet-large {
    max-height: 90vh;
}

.modal-sheet-large .modal-body {
    max-height: calc(90vh - 80px);
    overflow-y: auto;
}

.checklist-section {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin: var(--space-lg) 0;
    border: 1px solid var(--border);
}

.checklist-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent);
    margin: 0 0 4px 0;
}

.checklist-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 0 var(--space-md) 0;
}

.checklist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border);
}

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

.checklist-label {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

.checklist-options {
    display: flex;
    gap: var(--space-sm);
}

.checklist-option {
    cursor: pointer;
}

.checklist-option input[type="radio"] {
    display: none;
}

.checklist-option .option-yes,
.checklist-option .option-no {
    display: inline-block;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 600;
    transition: var(--transition);
    border: 2px solid transparent;
}

.checklist-option .option-yes {
    background: rgba(34, 197, 94, 0.1);
    color: var(--text-muted);
    border-color: var(--border);
}

.checklist-option .option-no {
    background: rgba(239, 68, 68, 0.1);
    color: var(--text-muted);
    border-color: var(--border);
}

.checklist-option input[type="radio"]:checked + .option-yes {
    background: var(--green);
    color: white;
    border-color: var(--green);
}

.checklist-option input[type="radio"]:checked + .option-no {
    background: var(--red);
    color: white;
    border-color: var(--red);
}

/* ============================================
   ADMIN ALERTS SECTION
   ============================================ */
.admin-alerts-section {
    margin-bottom: var(--space-lg);
}

.admin-alerts-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.alert-item {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    border-left: 4px solid var(--red);
}

.alert-item.resolved {
    border-left-color: var(--green);
    opacity: 0.6;
}

.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-sm);
}

.alert-operator {
    font-weight: 600;
    color: var(--text-primary);
}

.alert-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.alert-issues {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: var(--space-sm);
}

.alert-issue-badge {
    background: rgba(239, 68, 68, 0.2);
    color: var(--red);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.alert-actions {
    display: flex;
    gap: var(--space-sm);
}

.btn-resolve-alert {
    background: var(--green);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-dismiss-alert {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 6px 12px;
    font-size: 0.75rem;
    cursor: pointer;
}

/* ============================================
   NO OPERATOR OVERLAY - BLOCCO APP
   ============================================ */
.no-operator-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
}

.no-operator-overlay-content {
    text-align: center;
    max-width: 320px;
}

.no-operator-icon-large {
    font-size: 4rem;
    margin-bottom: var(--space-lg);
    opacity: 0.8;
}

.no-operator-overlay h2 {
    color: var(--accent);
    font-size: 1.5rem;
    margin-bottom: var(--space-md);
}

.no-operator-overlay p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: var(--space-xl);
    line-height: 1.5;
}

.btn-clock-in-large {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    padding: var(--space-md) var(--space-xl);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}

.btn-clock-in-large:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
}

.btn-clock-in-large:active {
    transform: scale(0.98);
}

/* ============================================
   DEVICE AUTHORIZATION OVERLAY
   ============================================ */
.device-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.98);
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
}

.device-overlay-content {
    text-align: center;
    max-width: 350px;
}

.device-icon {
    font-size: 4rem;
    margin-bottom: var(--space-lg);
}

.device-overlay h2 {
    color: var(--red);
    font-size: 1.4rem;
    margin-bottom: var(--space-md);
}

.device-overlay p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--space-md);
    line-height: 1.5;
}

.device-id-box {
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin: var(--space-lg) 0;
    border: 1px solid var(--border);
}

.device-id-box span {
    color: var(--text-muted);
    font-size: 0.8rem;
    display: block;
    margin-bottom: 4px;
}

.device-id-box code {
    color: var(--accent);
    font-size: 0.85rem;
    font-family: monospace;
    word-break: break-all;
}

.device-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
}

.btn-retry {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-md) var(--space-xl);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: var(--space-lg);
}

.btn-retry:hover {
    background: var(--bg-card);
    border-color: var(--accent);
}

/* ============================================
   ADMIN DEVICES SECTION
   ============================================ */
.admin-devices-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
    border: 1px solid var(--border);
}

.devices-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.devices-header h3 {
    font-size: 1rem;
    color: var(--text-primary);
    margin: 0;
}

.btn-refresh-devices {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 6px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-refresh-devices:hover {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
}

.devices-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.device-item {
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    border-left: 4px solid var(--border);
}

.device-item.pending {
    border-left-color: var(--accent);
}

.device-item.approved {
    border-left-color: var(--green);
}

.device-item.rejected {
    border-left-color: var(--red);
    opacity: 0.6;
}

.device-info {
    margin-bottom: var(--space-sm);
}

.device-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.device-details {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.device-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 8px;
}

.device-status.pending {
    background: rgba(245, 197, 24, 0.2);
    color: var(--accent);
}

.device-status.approved {
    background: rgba(34, 197, 94, 0.2);
    color: var(--green);
}

.device-status.rejected {
    background: rgba(239, 68, 68, 0.2);
    color: var(--red);
}

.device-actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.device-actions button {
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.btn-approve-device {
    background: var(--green);
    color: white;
}

.btn-reject-device {
    background: var(--red);
    color: white;
}

.btn-delete-device {
    background: var(--bg-primary);
    color: var(--text-muted);
    border: 1px solid var(--border) !important;
}

.btn-rename-device {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border) !important;
}

/* ============================================
   ADMIN SECTIONS - COLLAPSIBLE
   ============================================ */
.admin-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-md);
    border: 1px solid var(--border);
    overflow: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    background: var(--bg-elevated);
}

.collapsible .section-header {
    cursor: pointer;
    transition: var(--transition);
}

.collapsible .section-header:hover {
    background: var(--bg-card);
}

.section-header h3 {
    font-size: 1rem;
    color: var(--text-primary);
    margin: 0;
}

.section-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.section-toggle {
    color: var(--text-muted);
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    margin-left: var(--space-sm);
}

.section-toggle.collapsed {
    transform: rotate(-90deg);
}

.section-body {
    padding: var(--space-md);
    transition: all 0.3s ease;
}

.section-body.collapsed {
    display: none;
}

/* Override per dispositivi - sempre visibile */
#adminDevicesSection .section-header {
    cursor: default;
}

#adminDevicesSection .section-header:hover {
    background: var(--bg-elevated);
}

/* ============================================
   CHATBOT AI GROQ
   ============================================ */
.chatbot-section {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    margin: 0 var(--space-md);
    border-radius: var(--radius-lg);
    margin-top: var(--space-sm);
    overflow: hidden;
}

.chatbot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-elevated);
}

.chatbot-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.chatbot-icon {
    font-size: 1.2rem;
}

.chat-clear-btn {
    background: transparent;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    opacity: 0.6;
}

.chat-clear-btn:hover {
    background: var(--bg-card);
    opacity: 1;
}

.chatbot-body {
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-sm);
    max-height: 200px;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.chat-message {
    display: flex;
    max-width: 85%;
}

.chat-message.user {
    align-self: flex-end;
}

.chat-message.bot {
    align-self: flex-start;
}

.chat-message .message-content {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-lg);
    font-size: 0.85rem;
    line-height: 1.4;
}

.chat-message.user .message-content {
    background: var(--accent);
    color: var(--bg-primary);
}

.chat-message.bot .message-content {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.chat-message.bot.typing .message-content {
    color: var(--text-muted);
    font-style: italic;
}

.chat-input-area {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-sm);
    border-top: 1px solid var(--border);
    background: var(--bg-elevated);
}

.chat-input {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    font-size: 0.85rem;
    color: var(--text-primary);
}

.chat-input:focus {
    outline: none;
    border-color: var(--accent);
}

.chat-send-btn {
    background: var(--accent);
    border: none;
    border-radius: var(--radius-md);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.chat-send-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.chat-send-btn svg {
    width: 18px;
    height: 18px;
    stroke: var(--bg-primary);
}

/* ============================================
   DESKTOP / CHROME OPTIMIZATIONS
   ============================================ */
@media (min-width: 768px) {
    .app {
        max-width: 500px;
        margin: 0 auto;
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
        min-height: 100vh;
    }
    
    .login-screen.active {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .login-container {
        max-width: 400px;
        width: 100%;
    }
    
    .chatbot-section {
        margin: var(--space-sm) var(--space-md);
    }
    
    .chatbot-body {
        max-height: 250px;
    }
    
    .chat-messages {
        max-height: 180px;
    }
    
    .modal-sheet {
        max-width: 450px;
        margin: 0 auto;
    }
    
    .no-operator-overlay {
        max-width: 500px;
        margin: 0 auto;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .bottom-nav {
        max-width: 500px;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .floating-refresh-btn {
        left: calc(50% - 230px);
    }
}

@media (min-width: 1024px) {
    .app {
        max-width: 450px;
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
    }
    
    .chatbot-body {
        max-height: 220px;
    }
    
    .chat-messages {
        max-height: 150px;
    }
}
