:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --success: #10b981;
    --success-hover: #059669;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #0f172a;
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 32px 16px;
    -webkit-font-smoothing: antialiased;
}

.card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 460px;
    box-sizing: border-box;
    transition: max-width 0.3s ease;
}

.card.wide {
    max-width: 1050px;
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
    margin-top: 0;
    margin-bottom: 0.25rem;
}

h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* Badge di stato della rete */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}
.status-office { background: #d1fae5; color: #065f46; }
.status-external { background: #fef3c7; color: #92400e; }

/* Form Elements */
input, select {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    box-sizing: border-box;
    background: #fff;
    color: var(--text-main);
    transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Buttons */
button {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    background: var(--primary);
    color: white;
}
button:hover { background: var(--primary-hover); }
button:active { transform: scale(0.99); }
button:disabled { background: #cbd5e1; cursor: not-allowed; transform: none; }

.btn-timbra {
    background: var(--success);
    font-size: 1.15rem;
    padding: 16px;
    margin-top: 10px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}
.btn-timbra:hover { background: var(--success-hover); }

.btn-admin {
    background: var(--dark);
    margin-top: 14px;
    font-size: 0.95rem;
}
.btn-admin:hover { background: #1e293b; }

.btn-logout {
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 16px;
    padding: 8px;
}
.btn-logout:hover { color: var(--danger); background: #fee2e2; }

/* Orologio */
.clock {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--dark);
    margin: 16px 0;
    font-variant-numeric: tabular-nums;
    letter-spacing: -1px;
}

/* Messaggi di feedback */
.msg {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    display: none;
}
.msg.error { display: block; background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.msg.success { display: block; background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }

/* Tabelle moderne */
.table-container {
    overflow-x: auto;
    margin-top: 12px;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}
th, td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}
th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
    position: sticky;
    top: 0;
    z-index: 10;
}
tbody tr:hover { background: #f8fafc; }

/* Tag e Badge */
.tag {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.tag-office { background: #d1fae5; color: #065f46; }
.tag-remote { background: #fef3c7; color: #92400e; }
.tag-tm { background: #e0e7ff; color: #3730a3; }

.status-presente { background: #d1fae5; color: #065f46; padding: 4px 10px; border-radius: 12px; font-size: 0.8rem; font-weight: 600; }
.status-assente { background: #fef3c7; color: #92400e; padding: 4px 10px; border-radius: 12px; font-size: 0.8rem; font-weight: 600; }
.status-anomalia { background: #fee2e2; color: #991b1b; padding: 4px 10px; border-radius: 12px; font-size: 0.8rem; font-weight: 600; }

/* Navigazione a Schede (Tabs) */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 8px;
    flex-wrap: wrap;
}
.tab-btn {
    background: #e2e8f0;
    color: var(--text-muted);
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    width: auto;
}
.tab-btn.active {
    background: var(--dark);
    color: white;
}
.view-section { display: none; }
.view-section.active { display: block; }

.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.filters-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    align-items: center;
}
.filters-bar select, .filters-bar input {
    margin-bottom: 0;
    flex: 1;
    min-width: 180px;
}
.hidden { display: none !important; }