:root {
    --bg: #f8fafc;
    --text: #222;
    --card-bg: #fff;
    --card-shadow: 0 4px 12px rgba(0,0,0,0.05);
    --accent: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

[data-theme="dark"] {
    --bg: #1a1a2e;
    --text: #f0f0f0;
    --card-bg: #232946;
    --card-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; }
body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    transition: background 0.3s, color 0.3s;
}
.container { max-width: 1200px; margin: auto; padding: 0 1rem; }
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid #ddd;
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: bold; }
nav a { margin: 0 12px; text-decoration: none; color: var(--text); }
nav a:hover { color: #667eea; }
.theme-toggle {
    cursor: pointer; font-size: 1.2rem; margin-left: 15px;
}
.absolute-top-right {
    position: absolute; top: 10px; right: 10px;
}

.main-content { padding: 2rem 0; }

.form {
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.form-row { display: flex; gap: 1rem; }
.form-row > * { flex: 1; }
input, textarea, select {
    padding: 0.7rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    background: #fff;
    color: #222;
}
input:focus, textarea:focus { border-color: #667eea; }

.btn {
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: 0.2s;
}
.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}
.btn-primary:hover { box-shadow: 0 6px 18px rgba(102,126,234,0.25); }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.9rem; }
.danger { background: #e53935; color: white; }

.card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    padding: 1.5rem;
    margin: 1rem 0;
    transition: transform 0.2s;
}
.card:hover { transform: translateY(-4px); }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px,1fr));
    gap: 1rem;
    margin: 2rem 0;
}
.stats-grid .card { text-align: center; }
.bg-blue { border-left: 6px solid #1976d2; }
.bg-purple { border-left: 6px solid #7b1fa2; }
.bg-orange { border-left: 6px solid #f57c00; }
.bg-green { border-left: 6px solid #388e3c; }

.visitor-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
}
.visitor-table th, .visitor-table td {
    padding: 0.7rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}
.visitor-table tr:hover { background: #f4f6fc; }
.status.active { color: #388e3c; font-weight: bold; }
.status.out { color: #777; }

.visitor-photo { border-radius: 6px; }

.alert {
    padding: 0.7rem;
    margin: 0.5rem 0;
    border-radius: 5px;
}
.error { background: #ffcdd2; color: #c62828; }
.success { background: #c8e6c9; color: #2e7d32; }

.webcam-box { border: 1px dashed #ccc; text-align: center; padding: 1rem; }

.chart-container { max-width: 600px; margin: auto; }

.search-bar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.search-bar input { flex: 1; }

.mt-3 { margin-top: 2rem; }
.mb-2 { margin-bottom: 1rem; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px);}
    to { opacity: 1; transform: none;}
}
.animate-in { animation: fadeIn 0.6s 1; }

/* Responsive */
@media (max-width: 768px) {
    .form-row { flex-direction: column; }
    nav { display: flex; flex-direction: column; gap: 8px; }
    .stats-grid { grid-template-columns: 1fr; }
}
.login-bg { background: linear-gradient(120deg, #a18cd1 0%, #fbc2eb 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-container { background: rgba(255,255,255,0.95); padding: 2.5rem; border-radius: 20px; box-shadow: 0 8px 32px rgba(0,0,0,0.13); position: relative; }