* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: system-ui, -apple-system, sans-serif; background: #f1f5f9; color: #1e293b; line-height: 1.6; }

/* Auth pages */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #667eea, #764ba2); padding: 20px; }
.auth-card { background: #fff; border-radius: 16px; padding: 40px; max-width: 420px; width: 100%; box-shadow: 0 20px 40px rgba(0,0,0,0.15); }
.auth-header { text-align: center; margin-bottom: 32px; }
.auth-header h1 { font-size: 24px; font-weight: 700; color: #1e293b; margin-bottom: 8px; }
.auth-header p { color: #64748b; font-size: 15px; }

.auth-form { display: flex; flex-direction: column; gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 14px; font-weight: 600; color: #374151; }
.form-group input { width: 100%; padding: 12px 14px; border: 1px solid #e2e8f0; border-radius: 10px; font-size: 15px; outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
.form-group input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }

.btn-primary { display: block; width: 100%; padding: 14px; border-radius: 10px; background: #4f46e5; color: #fff; font-size: 15px; font-weight: 600; border: none; cursor: pointer; text-align: center; text-decoration: none; transition: background 0.2s; }
.btn-primary:hover { background: #4338ca; }

.auth-links { margin-top: 24px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.auth-links a { font-size: 14px; color: #6366f1; text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; }
.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* Admin layout */
.admin-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.admin-sidebar { width: 260px; background: #1e293b; color: #fff; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-brand { padding: 20px; border-bottom: 1px solid #334155; }
.sidebar-brand a { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 18px; font-weight: 700; }
.logo-icon { font-size: 24px; }

.sidebar-nav { flex: 1; padding: 16px 0; }
.nav-item { display: block; padding: 12px 20px; color: #94a3b8; text-decoration: none; font-size: 15px; transition: all 0.2s; }
.nav-item:hover { background: #334155; color: #fff; }
.nav-item.active { background: #4f46e5; color: #fff; }

.sidebar-footer { padding: 16px 20px; border-top: 1px solid #334155; }
.logout-link { display: block; color: #ef4444; text-decoration: none; font-size: 14px; font-weight: 500; }
.logout-link:hover { text-decoration: underline; }

/* Main content */
.admin-main { flex: 1; padding: 24px; overflow-x: auto; }

.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.admin-header h1 { font-size: 24px; font-weight: 700; color: #1e293b; }
.admin-user { display: flex; align-items: center; gap: 12px; }
.admin-user span { font-size: 14px; color: #64748b; }

.btn-sm { display: inline-block; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; border: 1px solid #e2e8f0; background: #fff; color: #374151; transition: all 0.2s; }
.btn-sm:hover { background: #f1f5f9; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 6px; border: none; cursor: pointer; font-size: 14px; transition: all 0.2s; }
.btn-warning { background: #fef3c7; color: #d97706; }
.btn-warning:hover { background: #fde68a; }
.btn-danger { background: #fee2e2; color: #dc2626; }
.btn-danger:hover { background: #fecaca; }
.btn-success { background: #dcfce7; color: #16a34a; }
.btn-success:hover { background: #bbf7d0; }
.btn-secondary { display: inline-block; padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 600; text-decoration: none; border: 1px solid #e2e8f0; background: #fff; color: #374151; transition: all 0.2s; }
.btn-secondary:hover { background: #f1f5f9; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.stat-value { font-size: 32px; font-weight: 700; color: #1e293b; }
.stat-label { font-size: 13px; color: #64748b; margin-top: 4px; }
.stat-active .stat-value { color: #16a34a; }
.stat-today .stat-value { color: #6366f1; }
.stat-users .stat-value { color: #d97706; }

/* Tables */
.section { margin-bottom: 32px; }
.section h2 { font-size: 18px; font-weight: 600; margin-bottom: 16px; color: #1e293b; }

.table-wrapper { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.05); overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; padding: 12px 16px; background: #f8fafc; font-weight: 600; color: #64748b; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8fafc; }

.link-primary { color: #4f46e5; text-decoration: none; }
.link-primary:hover { text-decoration: underline; }

.badge { display: inline-block; padding: 4px 10px; border-radius: 9999px; font-size: 12px; font-weight: 600; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-admin { background: #ede9fe; color: #6d28d9; }
.badge-owner { background: #e0e7ff; color: #3730a3; }

.text-muted { color: #94a3b8; font-style: italic; }
.inline-form { display: inline; }
.actions-cell { display: flex; gap: 6px; }

/* Sites grid (owner view) */
.sites-grid { display: grid; gap: 20px; }
@media (min-width: 640px) { .sites-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .sites-grid { grid-template-columns: repeat(3, 1fr); } }

.site-card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.site-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.site-card-header h3 { font-size: 16px; font-weight: 600; color: #1e293b; }
.site-slug { font-size: 13px; color: #6366f1; margin-top: 2px; }

.site-card-info { margin-bottom: 16px; }
.info-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.info-label { color: #64748b; }
.info-value { color: #1e293b; font-weight: 500; }

.site-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Empty state */
.empty-state { text-align: center; padding: 64px 20px; background: #fff; border-radius: 12px; }
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h2 { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.empty-state p { color: #64748b; margin-bottom: 24px; }
.empty-state .btn-primary { display: inline-block; width: auto; padding: 12px 24px; }

/* Mobile */
@media (max-width: 768px) {
    .admin-sidebar { width: 60px; }
    .sidebar-brand span, .sidebar-nav span, .nav-item { font-size: 0; padding: 14px; text-align: center; }
    .sidebar-brand .logo-icon { font-size: 24px; }
    .nav-item::first-letter { font-size: 16px; }
    .sidebar-footer { display: none; }
    .admin-main { padding: 16px; }
    .admin-header { flex-direction: column; align-items: flex-start; }
}
