:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1f2430;
  --muted: #7a8194;
  --line: #e7eaf2;
  --brand: #3b6cff;
  --brand-2: #6a4bff;
  --radius: 12px;
  --shadow: 0 4px 16px rgba(31,36,48,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
input, select, textarea, button { font-family: inherit; }

.admin { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.admin-side { background: #11162a; color: #c7cde0; padding: 22px 14px; }
.admin-brand { font-size: 18px; font-weight: 700; color: #fff; margin: 6px 8px 20px; display: flex; align-items: baseline; gap: 6px; }
.admin-brand small { font-size: 12px; color: #8b93b5; font-weight: 400; }
.admin-side nav { display: flex; flex-direction: column; gap: 4px; }
.admin-side nav a { padding: 10px 12px; border-radius: 9px; color: #c7cde0; font-size: 14.5px; }
.admin-side nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.admin-side nav a.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }

.admin-main { display: flex; flex-direction: column; min-width: 0; }
.admin-top {
  height: 60px; border-bottom: 1px solid var(--line); background: #fff;
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
}
.admin-title { font-size: 17px; font-weight: 600; }
.admin-user { color: var(--muted); font-size: 14px; }
.admin-content { padding: 24px; display: flex; flex-direction: column; gap: 18px; }

/* Stat cards */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); }
.stat-num { font-size: 28px; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat.ok { border-left: 4px solid #16c2a3; }
.stat.warn { border-left: 4px solid #ff8a3b; }

/* Panels */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.panel h3 { margin: 0 0 14px; font-size: 16px; }

/* Chart */
.chart { display: flex; align-items: flex-end; gap: 14px; height: 160px; padding-top: 10px; }
.bar { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; background: linear-gradient(180deg, var(--brand), var(--brand-2)); border-radius: 8px 8px 0 0; min-height: 6px; }
.bar-val { position: absolute; top: -20px; font-size: 12px; color: var(--muted); }
.bar-label { position: absolute; bottom: -22px; font-size: 12px; color: var(--muted); }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 13px; }
.tbl tbody tr:hover { background: #fafbff; }
.tbl .actions { display: flex; gap: 8px; }
.thumb img, .current-cover img { width: 64px; height: 44px; object-fit: cover; border-radius: 6px; }
.current-cover { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.badge { font-size: 12px; padding: 3px 9px; border-radius: 100px; }
.badge.published { background: #e3faf3; color: #0e9b7d; }
.badge.draft { background: #fff3e0; color: #c9701a; }

/* Forms */
label { display: block; font-size: 13.5px; color: #40475a; margin-bottom: 12px; font-weight: 500; }
label input, label select, label textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; font-size: 14px; font-weight: 400; color: var(--ink);
  background: #fff;
}
label input:focus, label select:focus, label textarea:focus { outline: none; border-color: var(--brand); }
textarea.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; font-size: 13px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline-form input { flex: 1; min-width: 160px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; }
.post-form { display: flex; flex-direction: column; gap: 18px; max-width: 860px; }
.panel.row { display: flex; align-items: center; gap: 14px; }
.panel.row .grow { flex: 1; }
label.inline { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
label.inline.check { font-weight: 400; }

/* Content editor toolbar */
.content-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.upload-img-btn { font-size: 13px; }
.upload-hint { font-size: 12px; color: #7a8194; }
.upload-hint.ok { color: #0e9b7d; }
.upload-hint.err { color: #d23048; }
.alert-error {
  background: #fff0f0;
  color: #d23048;
  border: 1px solid #ffbbc0;
  padding: 10px 14px;
  border-radius: 10px;
}
.hint-text { font-size: 12px; color: #8896ab; font-weight: normal; }
label.inline.check input { width: auto; margin: 0; }

/* Toolbar */
.toolbar { display: flex; align-items: center; gap: 14px; }

/* Filter tabs */
.filter-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filter-tabs .tab {
  padding: 5px 14px; border-radius: 20px; font-size: 13px; text-decoration: none;
  color: var(--muted); border: 1px solid var(--line); background: #fff; transition: .15s;
}
.filter-tabs .tab:hover { border-color: #b8c4e8; color: var(--brand); }
.filter-tabs .tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Avatar setting */
.avatar-setting { display: flex; align-items: center; gap: 18px; }
.avatar-preview { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; background: var(--line); display: flex; align-items: center; justify-content: center; }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-placeholder { font-size: 28px; }
.avatar-actions { display: flex; flex-direction: column; gap: 4px; }
.upload-hint { font-size: 12px; }
.upload-hint.err { color: #d23048; }

/* Captcha */
.captcha-label { display: block; font-size: 13.5px; color: #40475a; margin-bottom: 12px; }
.captcha-label input { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; ime-mode: disabled; }

/* Badge variants */
.badge.archived { background: #f0f0f0; color: #777; border: 1px solid #ddd; }

/* Frontend captcha widget */
.captcha-widget {
  margin: 10px 0; padding: 10px 12px; background: #f6f7fb;
  border-radius: 10px; border: 1px solid var(--line);
}
.captcha-widget label { display: block; font-size: 13px; color: #40475a; margin-bottom: 6px; }
.captcha-widget input {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 13px; ime-mode: disabled;
  box-sizing: border-box; margin-top: 4px;
}
.captcha-error { color: #d23048; font-size: 12px; margin-top: 4px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 15px; border-radius: 10px; border: 1px solid var(--line); background: #fff;
  color: var(--ink); cursor: pointer; font-size: 14px; transition: .15s;
}
.btn:hover { border-color: #cfd6e6; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #2f5be0; }
.btn.danger { color: #e23b50; border-color: #f3c2c9; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.alert { padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; font-size: 14px; }
.alert.error { background: #fdecee; color: #d23048; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#1f2a52,#3b6cff); }
.login-card { width: 340px; background: #fff; border-radius: 16px; padding: 30px; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.login-logo { width: 52px; height: 52px; border-radius: 14px; background: linear-gradient(135deg,var(--brand),var(--brand-2)); color: #fff; font-size: 26px; display: flex; align-items: center; justify-content: center; font-weight: 700; margin: 0 auto 14px; }
.login-card h2 { text-align: center; margin: 0 0 18px; }
.login-card label { display: block; font-size: 13.5px; color: #40475a; margin-bottom: 12px; }
.login-card input { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.login-card .hint { text-align: center; color: var(--muted); font-size: 12px; margin: 12px 0 0; }

@media (max-width: 760px) {
  .admin { grid-template-columns: 1fr; }
  .admin-side { display: none; }
}
