:root {
  --blue: #3f86ea;
  --blue-dark: #2f75d5;
  --blue-soft: #edf5ff;
  --ink: #263853;
  --muted: #73859d;
  --line: #e4ecf6;
  --bg: #f7faff;
  --white: #fff;
  --danger: #f05b6c;
  --shadow: 0 12px 32px rgba(72,112,163,.10);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter,"PingFang SC","Microsoft YaHei",system-ui,sans-serif; color: var(--ink); background: var(--bg); }
button,input,textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 150px 1fr; }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 26px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar-brand { color: #3f83de; font-size: 27px; font-family: "Segoe Script","Comic Sans MS",cursive; font-weight: 700; padding: 0 10px 26px; }
.sidebar nav { display: grid; gap: 7px; }
.side-tab { width: 100%; border: 0; border-radius: 8px; background: transparent; color: #5f7696; text-align: left; padding: 11px 12px; font-size: 13px; font-weight: 700; }
.side-tab:hover,.side-tab.active { background: #eaf3ff; color: #3b7fd9; }
.sidebar-bottom { margin-top: auto; display: grid; gap: 8px; }
.sidebar-bottom a,.sidebar-bottom button { width: 100%; display: block; border: 0; background: transparent; color: #637995; text-align: left; padding: 9px 10px; font-size: 12px; }
.admin-main { padding: 32px 38px 70px; min-width: 0; }
.admin-panel { display: none; }
.admin-panel.active { display: block; }
.admin-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.admin-heading h1 { margin: 4px 0 0; font-size: 25px; }
.eyebrow { color: #4b8de5; font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.primary-button,.secondary-button,.danger-button,.text-button { border: 0; border-radius: 8px; padding: 9px 14px; font-weight: 700; font-size: 12px; }
.primary-button { color: #fff; background: linear-gradient(135deg,#4a91ef,#337cde); box-shadow: 0 5px 14px rgba(63,134,234,.2); }
.secondary-button { color: #59708f; background: #edf3fa; }
.danger-button { color: #e85265; background: #fff0f2; }
.text-button { color: #3b80dc; background: #eaf3ff; }
.table-card,.settings-card { background: #fff; border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); }
.admin-table-scroll { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.admin-table th { text-align: left; color: #70829b; font-size: 11px; background: #f7faff; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.admin-table td { padding: 12px 14px; border-bottom: 1px solid #edf2f8; color: #4b5f7c; font-size: 12px; vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: 0; }
.thumb { width: 54px; height: 38px; object-fit: cover; border-radius: 5px; background: #eaf2fb; }
.demo-badge { display: inline-block; margin-left: 6px; background: #f0f6ff; color: #6981a1; padding: 2px 6px; border-radius: 6px; }
.status { display: inline-flex; padding: 3px 7px; border-radius: 7px; font-size: 10px; }
.status.online { background: #eaf8f1; color: #38976a; }
.status.offline { background: #f2f3f5; color: #818b98; }
.actions-cell { display: flex; align-items: center; gap: 7px; }
.inline-form { display: inline; }
.empty-row { text-align: center !important; color: #8b9ab0 !important; padding: 35px !important; }
.notice { margin-bottom: 16px; border-radius: 9px; padding: 10px 13px; font-size: 12px; }
.notice.success { background: #eaf8f1; color: #338b62; border: 1px solid #ccebdc; }
.notice.error { background: #fff0f2; color: #cf5362; border: 1px solid #ffd9de; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(340px,.9fr); gap: 20px; align-items: start; }
.settings-card { padding: 20px; }
.settings-card h2 { margin: 0 0 14px; font-size: 16px; }
.banner-preview { aspect-ratio: 4.9 / 1; overflow: hidden; border-radius: 9px; border: 1px solid var(--line); background: #eef5ff; margin-bottom: 18px; }
.banner-preview img { width: 100%; height: 100%; object-fit: cover; }
.stack-form { display: grid; gap: 13px; }
.stack-form label,.editor-form label { display: grid; gap: 6px; font-size: 12px; color: #536984; font-weight: 700; }
input,textarea { width: 100%; border: 1px solid #dce6f1; border-radius: 8px; background: #fff; color: #293c56; padding: 10px 11px; outline: 0; transition: border-color .15s, box-shadow .15s; }
input:focus,textarea:focus { border-color: #8db9f3; box-shadow: 0 0 0 3px #edf5ff; }
textarea { resize: vertical; min-height: 85px; }
.form-help { margin: 0; color: #8b9ab0; font-size: 11px; line-height: 1.6; font-weight: 400; }
.history-search { margin: 2px 0 12px; }
.history-list { display: grid; gap: 9px; max-height: 520px; overflow: auto; padding-right: 3px; }
.history-item { display: grid; grid-template-columns: 84px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 9px; border: 1px solid #e8eef6; border-radius: 9px; }
.history-item img { width: 84px; height: 42px; object-fit: cover; border-radius: 5px; background: #eef5ff; }
.history-meta { min-width: 0; }
.history-meta div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #5a6f8b; font-size: 11px; }
.history-meta small { color: #9aa7b8; font-size: 10px; }
.current-badge { background: #e8f3ff; color: #3d80d8; padding: 4px 7px; border-radius: 7px; font-size: 10px; }
.editor-modal { position: fixed; inset: 0; z-index: 50; display: none; }
.editor-modal.open { display: block; }
.editor-backdrop { position: absolute; inset: 0; background: rgba(24,42,67,.55); backdrop-filter: blur(2px); }
.editor-card { position: relative; z-index: 2; width: min(700px,calc(100vw - 30px)); max-height: calc(100vh - 34px); overflow: auto; margin: 17px auto; background: #fff; border-radius: 14px; box-shadow: 0 25px 70px rgba(35,66,105,.28); padding: 26px; }
.editor-close { position: absolute; top: 13px; right: 14px; border: 0; background: #edf3fa; color: #58708e; width: 30px; height: 30px; border-radius: 50%; font-size: 20px; }
.editor-heading h2 { margin: 4px 0 20px; font-size: 21px; }
.editor-form { display: grid; gap: 14px; }
.form-grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.toggle-row { display: flex; gap: 28px; padding: 4px 0; }
.check-label { display: flex !important; grid-template-columns: auto 1fr !important; align-items: center; gap: 7px !important; }
.check-label input { width: 16px; height: 16px; }
.editor-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 5px; }
.login-page { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 50% 15%,#eef6ff 0,#f8fbff 38%,#f2f6fb 100%); }
.login-card { width: min(370px,calc(100% - 32px)); background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 55px rgba(64,104,155,.14); padding: 32px; }
.login-logo { display: inline-block; font-family: "Segoe Script","Comic Sans MS",cursive; color: #3f83de; font-weight: 700; font-size: 27px; margin-bottom: 18px; }
.login-card h1 { margin: 0 0 6px; font-size: 23px; }
.login-card > p { margin: 0 0 22px; color: #8290a4; font-size: 12px; line-height: 1.7; }
.back-home { display: inline-block; margin-top: 17px; color: #6b83a4; font-size: 12px; }
@media (max-width: 880px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 12px 14px; flex-direction: row; align-items: center; gap: 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-brand { padding: 0; font-size: 22px; }
  .sidebar nav { display: flex; }
  .sidebar-bottom { margin: 0 0 0 auto; display: flex; }
  .sidebar-bottom a { display: none; }
  .sidebar-bottom button { white-space: nowrap; }
  .admin-main { padding: 22px 16px 50px; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .sidebar { overflow-x: auto; }
  .side-tab { white-space: nowrap; }
  .admin-heading { align-items: center; }
  .admin-heading h1 { font-size: 21px; }
  .form-grid.two { grid-template-columns: 1fr; }
  .toggle-row { flex-direction: column; gap: 10px; }
  .history-item { grid-template-columns: 70px minmax(0,1fr) auto; }
  .history-item img { width: 70px; }
}
