*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f4f6f9;
  --surface: #fff;
  --border: #e2e8f0;
  --text: #1a202c;
  --muted: #718096;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --success: #059669;
  --danger: #dc2626;
  --online: #10b981;
  --offline: #ef4444;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
}

body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; font-size: 15px; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
.muted { color: var(--muted); font-size: .85rem; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.req { color: var(--danger); }

/* Header */
header { background: #1e293b; padding: 12px 0; }
header .container { display: flex; align-items: center; justify-content: space-between; }
.logo { color: #fff; font-size: 1.1rem; font-weight: 700; }
.logo:hover { color: #93c5fd; }
nav { display: flex; gap: 24px; }
nav a { color: #94a3b8; font-size: .9rem; }
nav a:hover { color: #fff; }

main { padding: 28px 0 60px; }

footer { background: var(--surface); border-top: 1px solid var(--border); padding: 16px 0; margin-top: 40px; }
footer p { color: var(--muted); font-size: .8rem; text-align: center; }

/* Page header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h1 { font-size: 1.4rem; }
.page-header .muted { font-size: 1rem; font-weight: 400; color: var(--muted); margin-left: 8px; }
.back { color: var(--muted); font-size: .85rem; display: block; margin-bottom: 4px; }
.back:hover { color: var(--accent); }

/* Buttons */
.btn { display: inline-block; padding: 7px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: .875rem; cursor: pointer; transition: background .15s; }
.btn:hover { background: #f1f5f9; text-decoration: none; color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-danger { background: #fee2e2; border-color: #fca5a5; color: var(--danger); }
.btn-danger:hover { background: #fecaca; }
.btn-sm { padding: 4px 10px; font-size: .8rem; }
.btn-block { display: block; width: 100%; text-align: center; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; font-size: .9rem; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 40px; width: 100%; max-width: 380px; box-shadow: 0 4px 20px rgba(0,0,0,.08); }
.login-box h1 { font-size: 1.3rem; margin-bottom: 24px; text-align: center; }

/* Form */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.field input, .field select, .field textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: .9rem; font-family: inherit; background: var(--surface); color: var(--text); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.field textarea { resize: vertical; line-height: 1.6; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 12px; margin-top: 8px; }

/* Publish form */
.publish-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 32px; box-shadow: var(--shadow); }

/* Dashboard grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); transition: box-shadow .15s; }
.stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.stat-card.offline { border-left: 3px solid var(--offline); opacity: .7; }
.stat-card.online { border-left: 3px solid var(--online); }
.stat-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.online .status-dot { background: var(--online); }
.offline .status-dot { background: var(--offline); }
.site-name { font-weight: 600; font-size: .95rem; }
.vertical { color: var(--muted); font-size: .78rem; margin-left: auto; }
.stat-body { margin-bottom: 16px; }
.stat-num { font-size: 2rem; font-weight: 700; line-height: 1; color: var(--text); }
.stat-num span { font-size: 1rem; font-weight: 400; color: var(--muted); margin-left: 4px; }
.stat-date { color: var(--muted); font-size: .8rem; margin-top: 4px; }
.stat-foot { display: flex; gap: 8px; }

/* Table */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th { background: #f8fafc; padding: 10px 14px; text-align: left; font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: .9rem; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #f8fafc; }
.cat-tag { background: #eff6ff; color: #2563eb; font-size: .75rem; padding: 2px 8px; border-radius: 4px; font-weight: 500; white-space: nowrap; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 20px; }

/* Empty */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }

@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } .stats-grid { grid-template-columns: 1fr; } }
