* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: #f0f2f5; color: #333; line-height: 1.6; }

.admin-wrap { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #1e293b; color: #cbd5e1; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar .logo { padding: 20px; font-size: 18px; font-weight: 600; color: #fff; border-bottom: 1px solid #334155; }
.sidebar nav { flex: 1; padding: 12px 0; }
.sidebar nav a { display: block; padding: 10px 20px; color: #94a3b8; text-decoration: none; transition: background .2s, color .2s; }
.sidebar nav a:hover, .sidebar nav a.active { background: #334155; color: #fff; }
.sidebar .logout { padding: 14px 20px; color: #94a3b8; text-decoration: none; border-top: 1px solid #334155; }
.sidebar .logout:hover { color: #f87171; }

.main { flex: 1; padding: 24px 32px; overflow-x: auto; }
.page-header h1 { font-size: 24px; margin-bottom: 20px; }
.page-body { max-width: 1100px; }

.card { background: #fff; border-radius: 8px; padding: 20px 24px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.card h3 { margin-bottom: 16px; font-size: 16px; }
.card p { color: #666; margin-bottom: 8px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: 8px; padding: 20px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.stat-num { font-size: 32px; font-weight: 700; color: #2563eb; }
.stat-label { color: #888; font-size: 14px; margin-top: 4px; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eee; }
.table th { background: #f8fafc; font-weight: 600; color: #555; }
.table .empty { text-align: center; color: #999; padding: 24px; }
.table code.api-key { font-size: 12px; background: #f1f5f9; padding: 2px 6px; border-radius: 3px; word-break: break-all; }

.btn { display: inline-block; padding: 8px 16px; border: 1px solid #ddd; border-radius: 6px; background: #fff; color: #333; font-size: 14px; cursor: pointer; text-decoration: none; transition: background .2s; }
.btn:hover { background: #f8fafc; }
.btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { color: #dc2626; border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-block { display: block; width: 100%; }

.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 4px; font-size: 14px; color: #555; }
.field input, .field select, .field textarea { width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form input { flex: 1; min-width: 140px; padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; }
.actions form.inline { display: inline; }
.site-checkboxes label { margin-right: 16px; font-size: 14px; }

.site-card-highlight { box-shadow: 0 0 0 2px #2563eb; }
.site-card-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.site-card-info h3 { margin-bottom: 6px; font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.site-meta { font-size: 13px; color: #666; margin-bottom: 4px; word-break: break-all; }
.site-meta a { color: #2563eb; }
.site-card-actions { flex-shrink: 0; }
.site-embed { margin-top: 4px; }
.site-embed summary { cursor: pointer; font-size: 14px; color: #2563eb; padding: 8px 0; user-select: none; }
.site-embed .embed-block { margin-top: 12px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.badge-ok { background: #dcfce7; color: #16a34a; }
.badge-off { background: #f1f5f9; color: #64748b; }
.badge-warn { background: #fef3c7; color: #d97706; }

.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #dcfce7; color: #16a34a; }
.alert-error { background: #fee2e2; color: #dc2626; }

.guide-list { padding-left: 20px; color: #666; }
.guide-list li { margin-bottom: 6px; }

.embed-block { margin-bottom: 16px; }
.embed-block-primary { padding: 14px; background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 8px; }
.embed-block label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.embed-hint { font-size: 13px; color: #666; margin-bottom: 10px; }
.embed-advanced { margin-top: 12px; font-size: 14px; color: #555; }
.embed-advanced summary { cursor: pointer; padding: 8px 0; color: #2563eb; }
.embed-advanced .embed-block { margin-top: 12px; }
.code-block { background: #1e293b; color: #e2e8f0; padding: 14px; border-radius: 6px; overflow-x: auto; font-size: 13px; line-height: 1.5; margin-bottom: 8px; white-space: pre-wrap; word-break: break-all; }

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1e293b 0%, #334155 100%); }
.login-box { background: #fff; padding: 40px; border-radius: 12px; width: 100%; max-width: 380px; box-shadow: 0 8px 30px rgba(0,0,0,.2); }
.login-box h1 { text-align: center; margin-bottom: 4px; }
.login-box .subtitle { text-align: center; color: #888; margin-bottom: 24px; font-size: 14px; }

@media (max-width: 768px) {
  .admin-wrap { flex-direction: column; }
  .sidebar { width: 100%; }
  .sidebar nav { display: flex; flex-wrap: wrap; padding: 8px; }
  .sidebar nav a { padding: 8px 12px; }
}
