/* ============================================================
   Octer 管理系统 — 紫色主题(产品主色 #7C3AED)
   经典后台管理布局:固定左侧边栏 + 顶栏 + 卡片式内容。
   颜色集中在 :root 变量,便于统一调整深浅。
   ============================================================ */
:root {
  --purple: #7c3aed;
  --purple-dark: #6d28d9;
  --purple-darker: #5b21b6;
  --purple-light: #a78bfa;
  --purple-tint: #ede9fe;
  --purple-tint2: #f5f3ff;

  --sidebar-bg: #2b1055;
  --sidebar-text: #c9b8ef;
  --sidebar-hover: rgba(255, 255, 255, .08);

  --bg: #f6f7fb;
  --surface: #ffffff;
  --border: #e6e8ee;
  --border-soft: #f0f1f5;
  --text: #1f2937;
  --muted: #6b7280;
  --danger: #dc2626;
  --danger-soft: #fecaca;
  --ok: #059669;

  --radius: 8px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Segoe UI", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px; color: var(--text); background: var(--bg);
}

/* ===== 布局:侧边栏 + 顶栏 + 主区 ===== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand {
  font-weight: 700; color: #fff; font-size: 1.02rem; letter-spacing: .3px;
  padding: 1.1rem 1.2rem; border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar .nav { display: flex; flex-direction: column; gap: 2px; padding: .8rem .6rem; flex: 1; overflow-y: auto; }
.sidebar .nav a {
  color: var(--sidebar-text); text-decoration: none; padding: .58rem .8rem;
  border-radius: 6px; font-size: .9rem; transition: background .12s, color .12s;
}
.sidebar .nav a:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar .nav a.active { background: var(--purple); color: #fff; font-weight: 600; }

.app-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 1rem; height: 52px; padding: 0 1.2rem;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-spacer { flex: 1; }

.user-menu { position: relative; }
.user-btn {
  display: inline-flex; align-items: center; gap: .35rem; cursor: pointer;
  background: transparent; border: 1px solid var(--border); color: var(--text);
  padding: .35rem .8rem; border-radius: 6px; font-size: .85rem;
}
.user-btn:hover { background: var(--purple-tint2); border-color: var(--purple-light); }
.user-btn .caret { color: var(--muted); font-size: .7rem; }
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 150px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(16, 24, 40, .12); padding: .3rem; z-index: 30;
}
/* 下拉里两个按钮(含 logout 的 submit)统一成朴素菜单项;
   选择器带上 form button[type=submit] 以盖过全局那条 form 提交按钮规则,
   否则退出按钮会变紫底、hover 时深紫字撞深紫底导致文字消失。 */
.user-dropdown button,
.user-dropdown form button[type=submit] {
  display: block; width: 100%; text-align: left; background: transparent; border: 0;
  padding: .5rem .7rem; border-radius: 6px; cursor: pointer; font-size: .85rem; color: var(--text); margin: 0;
}
.user-dropdown button:hover,
.user-dropdown form button[type=submit]:hover { background: var(--purple-tint2); color: var(--purple-dark); }
.user-dropdown form { margin: 0; }

.main { padding: 1.3rem 1.5rem; flex: 1; }
.main-plain { padding: 1.3rem; }

/* ===== 排版 ===== */
h1 { font-size: 1.35rem; margin: 0 0 .8rem; }
h2 { font-size: 1.12rem; margin: 1.6rem 0 .6rem; padding-bottom: .3rem; border-bottom: 1px solid var(--border); }
h3 { font-size: .95rem; margin: 1rem 0 .5rem; color: #374151; }
.muted { color: var(--muted); font-size: .85rem; }
.center { text-align: center; }
.err { color: var(--danger); margin-top: .6rem; }
.ok { background: #d1fae5; color: #065f46; padding: .6rem .9rem; border-radius: 6px; margin-bottom: 1rem; }

/* ===== 信息提示条 ===== */
.note {
  background: var(--purple-tint2); border-left: 3px solid var(--purple);
  padding: .6rem .9rem; border-radius: 6px; margin-bottom: 1rem;
  font-size: .85rem; color: #4c3a76;
}
.note code { background: var(--purple-tint); padding: 0 .3rem; border-radius: 3px; }

/* ===== 筛选栏 ===== */
.filterbar {
  display: flex; gap: 1rem; align-items: center; flex-wrap: wrap;
  background: var(--surface); padding: .8rem 1rem; border-radius: var(--radius);
  border: 1px solid var(--border); margin-bottom: 1rem; box-shadow: var(--shadow);
}
.filterbar input { padding: .35rem .55rem; border: 1px solid #d5d8e0; border-radius: 6px; }
.filterbar button { background: var(--purple); color: #fff; border: 0; padding: .38rem .95rem; border-radius: 6px; cursor: pointer; }
.filterbar button:hover { background: var(--purple-dark); }
.filterbar button.btn-secondary { background: #fff; color: var(--text); border: 1px solid #d5d8e0; }
.filterbar button.btn-secondary:hover { background: var(--purple-tint2); border-color: var(--purple-light); }

/* ===== 表格(所有 group 页共用)===== */
.tablewrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }
table.data { width: 100%; border-collapse: collapse; font-size: .82rem; }
table.data th, table.data td { padding: .4rem .65rem; border-bottom: 1px solid var(--border-soft); text-align: left; vertical-align: top; }
table.data th { background: #faf9fe; font-weight: 600; position: sticky; top: 0; color: #4b4763; }
table.data tbody tr:hover { background: var(--purple-tint2); }
table.data tr.editing { background: var(--purple-tint2); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.nowrap { white-space: nowrap; }
table.data details ul { margin: .2rem 0; padding-left: 1rem; }
table.data details summary { cursor: pointer; color: var(--purple-dark); }

/* 骨架屏 */
tr.skeleton td { padding: .5rem .6rem; }
.skel-bar {
  display: inline-block; height: 12px; width: 70%;
  background: linear-gradient(90deg, #ece9f5 0%, #f5f3fb 50%, #ece9f5 100%);
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: 3px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ===== 登录 / 无权限卡 ===== */
.login-card {
  max-width: 380px; margin: 8vh auto; padding: 2rem 2.2rem; background: var(--surface);
  border-radius: 12px; box-shadow: 0 8px 30px rgba(91, 33, 182, .12); border-top: 3px solid var(--purple);
}
.login-card h1 { font-size: 1.3rem; margin-bottom: .2rem; }
.login-card form { display: flex; flex-direction: column; gap: .8rem; margin-top: 1.2rem; }
.login-card label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: #4b5563; }
.login-card input { padding: .6rem .75rem; border: 1px solid #d5d8e0; border-radius: 7px; font-size: 1rem; }
.login-card input:focus { outline: none; border-color: var(--purple-light); box-shadow: 0 0 0 3px var(--purple-tint); }
.login-card button { background: var(--purple); color: #fff; border: 0; padding: .65rem; border-radius: 7px; cursor: pointer; font-size: 1rem; }
.login-card button:hover { background: var(--purple-dark); }

/* ===== 数据问答 ===== */
.chatform { display: flex; gap: .5rem; align-items: flex-end; margin-top: 1rem; }
.chatform textarea { flex: 1; padding: .55rem .7rem; border: 1px solid #d5d8e0; border-radius: 6px; resize: vertical; font: inherit; }
.chatform button { padding: .5rem 1rem; border-radius: 6px; border: 0; cursor: pointer; }
.chatform button[type=submit] { background: var(--purple); color: #fff; }
.chatform button[type=submit]:hover { background: var(--purple-dark); }
.chatform button#clearbtn { background: #e9e7f0; }
.chatlog { background: var(--surface); padding: 1rem; border-radius: var(--radius); border: 1px solid var(--border); max-height: 60vh; overflow-y: auto; box-shadow: var(--shadow); }
.msg { margin-bottom: 1rem; }
.msg b { display: block; font-size: .8rem; color: var(--muted); margin-bottom: .2rem; }
.msg .bubble { background: #f1f2f6; padding: .5rem .8rem; border-radius: 8px; white-space: pre-wrap; }
.msg.user .bubble { background: var(--purple-tint); }
.trace { margin-top: .3rem; }
.trace pre { background: #2b1055; color: #d7ccf3; padding: .8rem; border-radius: 6px; font-size: .75rem; overflow-x: auto; max-height: 200px; }

/* ===== 配置中心表单 ===== */
textarea.full { width: 100%; padding: .6rem; border: 1px solid #d5d8e0; border-radius: 6px; font-family: ui-monospace, monospace; }
pre.readonly { background: #f1f2f6; padding: .8rem; border-radius: 6px; font-size: .8rem; max-height: 220px; overflow: auto; }
form button[type=submit] { background: var(--purple); color: #fff; border: 0; padding: .5rem 1.2rem; border-radius: 6px; cursor: pointer; margin-top: .6rem; }
form button[type=submit]:hover { background: var(--purple-dark); }

.addbar { display: flex; gap: .5rem; margin-bottom: .8rem; max-width: 520px; }
.addbar input { flex: 1; padding: .45rem .6rem; border: 1px solid #d5d8e0; border-radius: 6px; font: inherit; font-family: ui-monospace, monospace; }
.patlist { list-style: none; margin: 0; padding: 0; max-width: 520px; }
.patrow {
  display: flex; align-items: center; gap: .5rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px; padding: .4rem .6rem; margin-bottom: .4rem;
}
.patrow.editing { border-color: var(--purple); box-shadow: 0 0 0 2px var(--purple-tint); }
.pattext { flex: 1; font-family: ui-monospace, monospace; word-break: break-all; }
.editinput { flex: 1; padding: .35rem .5rem; border: 1px solid var(--purple-light); border-radius: 6px; font: inherit; font-family: ui-monospace, monospace; }

/* ===== 按钮 ===== */
.rowactions { display: flex; gap: .35rem; flex-shrink: 0; }
.btn-sm { background: #fff; color: var(--text); border: 1px solid #d5d8e0; padding: .25rem .7rem; border-radius: 6px; cursor: pointer; font-size: .8rem; }
.btn-sm:hover { background: var(--purple-tint2); border-color: var(--purple-light); }
.btn-primary { background: var(--purple); color: #fff; border: 0; cursor: pointer; }
.btn-primary:hover { background: var(--purple-dark); }
.btn-primary.danger { background: var(--danger); color: #fff; }
.btn-primary.danger:hover { background: #b91c1c; }
button.btn-primary { padding: .3rem .95rem; border-radius: 6px; font-size: .8rem; }
/* 禁用态:置灰 + 禁用光标,并盖掉 hover 高亮 */
.btn-sm:disabled, .btn-primary:disabled, button:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm:disabled:hover { background: #fff; border-color: #d5d8e0; }
.btn-primary:disabled:hover { background: var(--purple); }
.addbar button.btn-primary { padding: .48rem 1.2rem; font-size: .85rem; }
.userform button.btn-primary { padding: .45rem 1.2rem; font-size: .85rem; }
.btn-danger { color: var(--danger); border-color: var(--danger-soft); }
.btn-danger:hover { background: #fef2f2; }
.btn-publish { color: #047857; border-color: #a7f3d0; background: #ecfdf5; }
.btn-publish:hover { background: #d1fae5; border-color: #6ee7b7; }
.btn-unpublish { color: #b45309; border-color: #fed7aa; background: #fff7ed; }
.btn-unpublish:hover { background: #ffedd5; border-color: #fdba74; }

/* ===== chips ===== */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; max-width: 720px; }
.chip { background: var(--purple-tint2); border: 1px solid var(--purple-tint); color: #5b4a86; padding: .2rem .55rem; border-radius: 999px; font-size: .8rem; font-family: ui-monospace, monospace; }

/* ===== 新用户:顶部报表 ===== */
.report-grid {
  display: grid; grid-template-columns: minmax(0, 3fr) minmax(300px, 2fr);
  gap: 1rem; margin-bottom: 1rem;
}
.report-card {
  min-width: 0; padding: 1rem 1.1rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.report-card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin-bottom: .7rem;
}
.report-card-head h2 { margin: 0; padding: 0; border: 0; font-size: 1rem; }
.report-card-head p { margin: .25rem 0 0; color: var(--muted); font-size: .78rem; }
.report-total {
  flex-shrink: 0; padding: .2rem .55rem; border-radius: 999px;
  background: var(--purple-tint); color: var(--purple-darker); font-size: .78rem; font-weight: 600;
}
.report-chart { position: relative; height: 260px; }
.report-empty {
  position: absolute; inset: 0; display: grid; place-items: center;
  margin: 0; color: var(--muted); font-size: .85rem;
}
.report-empty[hidden] { display: none; }

/* ===== 分组权限徽标 ===== */
.badge { display: inline-block; background: var(--purple-tint); color: var(--purple-darker); border: 1px solid #ddd4f7; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; margin: 0 .25rem .2rem 0; }

/* ===== toast ===== */
.toast {
  position: fixed; top: 4rem; right: 1.2rem; z-index: 60; background: var(--ok); color: #ecfdf5;
  padding: .55rem .9rem; border-radius: 8px; font-size: .85rem; box-shadow: 0 6px 18px rgba(16, 24, 40, .18);
}
.toast.toast-err { background: #b91c1c; color: #fef2f2; }

/* ===== 用户明细:备注按钮 ===== */
.username-action {
  appearance: none; border: 0; border-bottom: 1px dashed currentColor; padding: 0;
  background: transparent; color: var(--purple-dark); font: inherit; cursor: pointer;
  text-align: left;
}
.username-action:hover { color: var(--purple-darker); }
.btn-remark {
  display: inline-block; margin-left: .35rem; text-decoration: none; color: #a99fc4;
  font-size: .8rem; line-height: 1; padding: .05rem .3rem; border-radius: 3px; border: 1px solid transparent;
}
.btn-remark:hover { color: var(--purple-dark); border-color: var(--purple-tint); background: var(--purple-tint2); }

/* ===== 配置中心:用户备注 ===== */
.remarkbar { max-width: 640px; }
.remarkbar .remark-username { flex: 0 0 200px; font-family: ui-monospace, monospace; }
.remarkbar .remark-text { flex: 1; font-family: inherit; }
.remarkrow .remark-name { flex: 0 0 200px; font-family: ui-monospace, monospace; word-break: break-all; font-weight: 600; }
.remarkrow .remark-arrow { color: #a99fc4; flex-shrink: 0; }
.remarkrow .remark-val { flex: 1; word-break: break-word; }
.remarkrow .editinput { font-family: inherit; }
.remarkrow.flash { animation: rowflash 1.6s ease-out; }
@keyframes rowflash {
  0%   { background: var(--purple-tint); border-color: var(--purple); }
  100% { background: #fff; border-color: var(--border); }
}

/* ===== 用户管理:列表头 + 勾选框 + 行内编辑 ===== */
.listhead { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.listhead h2 { margin-bottom: 0; }
.listhead button.btn-primary { padding: .48rem 1.2rem; font-size: .85rem; }
.checkbox-grid { display: flex; flex-wrap: wrap; gap: .6rem 1.5rem; align-items: center; }
.checkbox-item { display: inline-flex; align-items: center; gap: .3rem; font-size: .82rem; cursor: pointer; }
.permeditor { display: flex; flex-direction: column; gap: .7rem; }
.permission-details { display: flex; flex-direction: column; gap: .8rem; }
.permission-section { display: flex; flex-direction: column; gap: .35rem; }
.permission-section-title { color: var(--muted); font-size: .78rem; font-weight: 600; }
.permeditor select {
  width: 100%; padding: .5rem 2.2rem .5rem .7rem;
  border: 1px solid #d5d8e0; border-radius: 7px; font: inherit; font-size: .9rem;
  color: var(--text); cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background: #fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%237c6bb0' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right .7rem center;
}
.permeditor select:hover { border-color: var(--purple-light); }
.permeditor select:focus { outline: none; border-color: var(--purple-light); box-shadow: 0 0 0 3px var(--purple-tint); }
.permeditor .checkbox-grid { padding: .1rem .1rem 0; }
.permeditor .checkbox-grid[hidden] { display: none; }
.permeditor .permission-details[hidden] { display: none; }
.editrow { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

/* ===== 新闻分组管理:创建表单(复用 userform 范式)===== */
.userform {
  display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem;
  box-shadow: var(--shadow); margin-bottom: 1rem;
}
.userform input { padding: .45rem .6rem; border: 1px solid #d5d8e0; border-radius: 6px; font: inherit; }
/* 分组管理表单:按钮与输入框顶部对齐、同高同大小 */
.userform.catform { align-items: flex-start; }
.userform.catform button.btn-primary { padding: .45rem 1.5rem; font: inherit; border: 1px solid transparent; margin-top: 0.2px;}
.author-avatar-preview,
.author-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: #eef0f4; border: 1px solid var(--border); }
table.data.author-table th,
table.data.author-table td { vertical-align: middle; }
table.data.news-list-table th,
table.data.news-list-table td { vertical-align: middle; }
div.news-toolbar.author-page-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
}
.author-page-toolbar .btn-primary { padding: .55rem 1rem; }
.modal-card.author-modal-card {
  width: min(600px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  gap: 0;
  overflow: hidden;
  border: 1px solid rgba(124, 58, 237, .1);
  box-shadow: 0 22px 60px rgba(35, 26, 62, .22);
}
.author-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.author-modal-head h2 { margin: 0; font-size: 1.08rem; color: var(--text); }
.author-modal-close {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
.author-modal-close:hover { color: var(--text); background: #f0edf7; }
.author-modal-form {
  display: flex;
  flex-direction: column;
  gap: .9rem;
  padding: 1.15rem 1.25rem 1.25rem;
  overflow-y: auto;
}
.author-avatar-field { display: flex; flex-direction: column; gap: .5rem; }
.author-field-label,
.author-form-field > span { font-size: .82rem; font-weight: 600; color: var(--text); }
.author-field-label em,
.author-form-field em { color: var(--danger); font-style: normal; }
.author-avatar-row {
  display: flex;
  align-items: center;
  gap: .85rem;
}
.author-avatar-frame {
  position: relative;
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: #f6f3ff;
  border: 1px solid #ded5f7;
  color: #8b78bf;
  font-size: 1.25rem;
}
.author-avatar-frame .author-avatar-preview { width: 100%; height: 100%; border: 0; }
.author-upload-copy { display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; min-width: 0; }
.author-upload-copy small { line-height: 1.35; font-size: .72rem; }
.author-upload-button { cursor: pointer; padding: .35rem .7rem; }
.author-upload-copy input[type="file"] { display: none; }
.author-form-field { display: flex; flex-direction: column; gap: .35rem; }
.author-form-field small { margin-left: .25rem; font-weight: 400; color: var(--muted); }
.author-form-field input {
  width: 100%;
  box-sizing: border-box;
  padding: .55rem .7rem;
  border: 1px solid #d5d8e0;
  border-radius: 8px;
  font: inherit;
}
.author-form-field input:focus {
  outline: none;
  border-color: var(--purple-light);
  box-shadow: 0 0 0 3px var(--purple-tint);
}
.author-modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .55rem;
  margin-top: .15rem;
  padding-top: .9rem;
  border-top: 1px solid var(--border);
}
.author-modal-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 120px;
  width: 120px;
  height: 40px;
  margin: 0 !important;
  box-sizing: border-box;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: .85rem;
  line-height: 1;
  vertical-align: middle;
}
.author-modal-actions .btn-sm { border-color: #d5d8e0; }

/* ===== 新闻分组管理:新增/编辑弹窗 ===== */
div.news-toolbar.category-page-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
}
.category-page-toolbar .btn-primary { padding: .55rem 1rem; }
.modal-card.category-modal-card {
  width: min(680px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  gap: 0;
  overflow: hidden;
}
.category-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.3rem 1rem;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.category-modal-head h2 { margin: 0; font-size: 1.08rem; color: var(--text); }
.category-modal-head p { margin: .28rem 0 0; color: var(--muted); font-size: .78rem; }
.category-modal-close {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
.category-modal-close:hover { color: var(--text); background: #eef2f8; }
.category-modal-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.2rem 1.3rem 1.3rem;
  overflow-y: auto;
}
.category-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .9rem 1rem;
}
.category-form-field { display: flex; min-width: 0; flex-direction: column; gap: .38rem; }
.category-form-field > span { color: var(--text); font-size: .82rem; font-weight: 600; }
.category-form-field em { color: var(--danger); font-style: normal; }
.category-form-field small { color: var(--muted); font-size: .72rem; line-height: 1.35; }
.category-form-field input {
  width: 100%;
  box-sizing: border-box;
  padding: .58rem .7rem;
  border: 1px solid #929aa8;
  border-radius: 4px;
  font: inherit;
}
.category-form-field input:focus {
  outline: none;
  border-color: #1769ff;
  box-shadow: 0 0 0 2px rgba(23, 105, 255, .2);
}
.category-modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .55rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.category-modal-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  height: 40px;
  margin: 0;
  padding: 0 1rem;
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .category-form-grid { grid-template-columns: 1fr; }
  .category-modal-head,
  .category-modal-form { padding-right: 1rem; padding-left: 1rem; }
  .category-modal-actions button { flex: 1; min-width: 0; }
}

/* ===== 修改密码弹窗 ===== */
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(30, 20, 60, .4); display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal-card {
  background: var(--surface); border-radius: 12px; box-shadow: 0 20px 60px rgba(30, 20, 60, .3);
  padding: 1.5rem 1.6rem; width: 320px; display: flex; flex-direction: column; gap: .7rem;
}
.modal-card h2 { margin: 0 0 .3rem; border: 0; padding: 0; font-size: 1.1rem; }
.modal-card input { padding: .55rem .7rem; border: 1px solid #d5d8e0; border-radius: 7px; font-size: .95rem; }
.modal-card input:focus { outline: none; border-color: var(--purple-light); box-shadow: 0 0 0 3px var(--purple-tint); }
.modal-card-wide { width: 480px; max-width: calc(100vw - 2rem); }
.modal-card-code { width: 680px; max-width: calc(100vw - 2rem); }
.magic-warning { color: #92400e; background: #fffbeb; border: 1px solid #fde68a; padding: .55rem .7rem; border-radius: 7px; }
.magic-code { margin: 0; max-height: 260px; white-space: pre-wrap; word-break: break-all; user-select: all; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .3rem; }
.modal-actions .btn-primary { padding: .45rem 1.1rem; border-radius: 7px; }
.modal-card .modal-msg { margin: 0; color: var(--text); font-size: .9rem; line-height: 1.55; }
/* 确认弹窗的“确定”在危险操作(删除)时显示为红色实心 */
#confirmOk.danger { background: var(--danger); color: #fff; border: 0; }
#confirmOk.danger:hover { background: #b91c1c; }
/* 编辑页预览弹窗:更宽、可滚动;正文里图片/表格自适应 */
.preview-card { display: flex; flex-direction: column; max-width: 820px; width: 92%; max-height: 86vh; align-items: stretch; }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.preview-body { overflow-y: auto; min-height: 0; }
.preview-title { font-size: 1.5rem; margin: .2rem 0 .8rem; }
.preview-content { line-height: 1.7; color: var(--text); word-break: break-word; }
.preview-content img, .preview-content video { max-width: 100%; height: auto; }
.preview-content table { border-collapse: collapse; }
.preview-content td, .preview-content th { border: 1px solid #d5d8e0; padding: .3rem .5rem; }
.markdown-card { display: flex; flex-direction: column; width: 720px; max-width: calc(100vw - 2rem); max-height: 86vh; align-items: stretch; }
.source-card { display: flex; flex-direction: column; width: 860px; max-width: calc(100vw - 2rem); max-height: 86vh; align-items: stretch; }
.markdown-file-row { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.markdown-file-label { cursor: pointer; }
.markdown-file-label input { display: none; }
.markdown-input, .source-input { min-height: 360px; resize: vertical; padding: .7rem .8rem; border: 1px solid #d5d8e0; border-radius: 7px; font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.markdown-input:focus, .source-input:focus { outline: none; border-color: var(--purple-light); box-shadow: 0 0 0 3px var(--purple-tint); }

/* ===== 窄屏折叠:侧边栏变顶部横条 ===== */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .sidebar .brand { border-bottom: 0; padding: .7rem 1rem; }
  .sidebar .nav { flex-direction: row; flex-wrap: wrap; padding: .4rem .6rem; }
  .report-grid { grid-template-columns: 1fr; }
}

/* ===== 新闻管理 ===== */
a.btn-sm, a.btn-primary { text-decoration: none; display: inline-flex; align-items: center; }
.news-toolbar { display: flex; gap: .8rem; align-items: center; margin-bottom: .4rem; }
.news-toolbar #q { flex: 1; max-width: 360px; padding: .45rem .7rem; border: 1px solid #d5d8e0; border-radius: 7px; font: inherit; }
.news-new { padding: .45rem 1rem; border-radius: 7px; font-size: .8rem; justify-content: center; }
/* 管理入口与新增按钮等宽排列 */
.news-toolbar .btn-pair { display: inline-grid; grid-auto-flow: column; grid-auto-columns: minmax(112px, 132px); gap: .6rem; }
.btn-pair .news-new { width: 100%; }

.badge-ok { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.lang-dots { display: inline-flex; gap: .25rem; }
.lang-dot { display: inline-block; padding: .05rem .32rem; border-radius: 4px; font-size: .7rem; text-transform: uppercase; background: #eef0f4; color: #9aa1af; border: 1px solid #e3e6ec; }
.lang-dot.on { background: var(--purple-tint); color: var(--purple-darker); border-color: #ddd4f7; }

.news-edit-top { display: flex; align-items: center; flex-wrap: wrap; gap: .8rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .7rem 1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.news-edit-top label:not(.chk) { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.news-edit-top label { font-size: .85rem; color: var(--muted); }
.news-edit-top #weight { width: 80px; padding: .3rem .5rem; border: 1px solid #d5d8e0; border-radius: 6px; font: inherit; }
.news-edit-top .spacer { flex: 1; }

.news-tabs { display: flex; gap: .3rem; border-bottom: 2px solid var(--border); margin-bottom: 1rem; }
.news-tabs .tab { background: transparent; border: 0; border-bottom: 2px solid transparent; margin-bottom: -2px; padding: .5rem 1.1rem; cursor: pointer; font-size: .9rem; color: var(--muted); }
.news-tabs .tab:hover { color: var(--purple-dark); }
.news-tabs .tab.active { color: var(--purple-dark); border-bottom-color: var(--purple); font-weight: 600; }

.lang-panel .field { display: block; margin-bottom: .9rem; }
.lang-panel .field > span { display: block; font-size: .82rem; color: var(--muted); margin-bottom: .25rem; }
.field-head { display: flex; align-items: center; justify-content: space-between; gap: .7rem; margin-bottom: .25rem; }
.field-head > span { color: var(--muted); font-size: .82rem; }
.editor-extra-actions { display: inline-flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.source-edit-btn,
.markdown-import-btn { padding: .28rem .65rem; font-size: .78rem; }
.lang-panel input, .lang-panel textarea { width: 100%; padding: .5rem .65rem; border: 1px solid #d5d8e0; border-radius: 7px; font: inherit; }
.lang-panel input:focus, .lang-panel textarea:focus { outline: none; border-color: var(--purple-light); box-shadow: 0 0 0 3px var(--purple-tint); }

/* 不能 overflow:hidden —— 会裁掉 wangEditor 溢出容器的悬浮菜单/弹窗 */
.editor-wrap { border: 1px solid #d5d8e0; border-radius: 7px; }
.editor-toolbar { border-bottom: 1px solid var(--border); border-top-left-radius: 7px; border-top-right-radius: 7px; }
.editor-body { min-height: 300px; }
.fallback-content { width: 100%; border: 0; padding: .6rem; font-family: ui-monospace, monospace; resize: vertical; }

/* 二期:列表筛选栏 / 徽标 / 编辑页文章级控件 */
.news-filterbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .6rem; flex-wrap: wrap; }
.news-filterbar .news-tabs { margin-bottom: 0; }
.filter-cat { font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; }
.filter-cat select { padding: .35rem .55rem; border: 1px solid #d5d8e0; border-radius: 6px; font: inherit; }
.news-title-cell { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; max-width: 200px; }
.news-title-text {
  display: block;
  max-width: 200px;
  overflow: hidden;
  color: var(--text);
  line-height: 1.45;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.news-title-text:hover { color: var(--purple-dark); text-decoration: underline; }
.news-url-td { min-width: 120px; }
.news-url-cell { display: flex; flex-direction: column; gap: .25rem; align-items: flex-start; }
.news-url-langs { display: inline-flex; flex-wrap: wrap; gap: .3rem; }
.news-url-langs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.15rem;
  padding: .08rem .36rem;
  border-radius: 4px;
  border: 1px solid #ddd4f7;
  background: var(--purple-tint);
  color: var(--purple-darker);
  font-size: .68rem;
  font-weight: 700;
  text-decoration: none;
}
.news-url-langs a:hover { filter: brightness(.97); }
.data td.center, .data th.center { text-align: center; }
.data td.center input[type="checkbox"] { cursor: pointer; }
.badge-top { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.badge-essence { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.news-edit-top input[type="text"],
.news-edit-top input[type="number"] { padding: .3rem .5rem; border: 1px solid #d5d8e0; border-radius: 6px; font: inherit; line-height: 1.35; }
.news-edit-top #slug { width: min(480px, 100%); min-width: 280px; flex-shrink: 1; }
.news-edit-top select { padding: .3rem .5rem; border: 1px solid #d5d8e0; border-radius: 6px; font: inherit; }
.news-edit-top .chk { display: inline-flex; align-items: center; gap: .3rem; cursor: pointer; white-space: nowrap; }
.news-edit-top .chk input { width: auto; }
.news-edit-top button,
.news-edit-top a.btn-sm,
.news-edit-top a.btn-primary { display: inline-flex; align-items: center; justify-content: center; }
.news-edit-top [hidden] { display: none; }
.news-edit-top #statusLabel { margin: 0; }

@media (max-width: 1180px) {
  .news-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: stretch;
    gap: .7rem;
  }
  .news-toolbar #q {
    max-width: none;
    min-width: 0;
    width: 100%;
  }
  .news-toolbar .spacer { display: none; }
  .news-toolbar .btn-pair {
    display: contents;
  }
  .news-toolbar .news-new {
    padding: .45rem .85rem;
    min-width: 112px;
    white-space: nowrap;
  }
  .news-filterbar {
    align-items: flex-start;
  }
  .news-filterbar .news-tabs {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scrollbar-width: none;
  }
  .news-filterbar .news-tabs::-webkit-scrollbar { display: none; }
  .filter-cat {
    margin-left: auto;
  }

  .tablewrap {
    overflow: visible;
    background: transparent;
    border: 0;
    box-shadow: none;
    border-radius: 0;
  }
  table.data,
  table.data tbody,
  table.data tr,
  table.data td {
    display: block;
  }
  table.data {
    border-collapse: separate;
    border-spacing: 0;
  }
  table.data thead { display: none; }
  table.data tbody {
    display: grid;
    gap: .85rem;
  }
  table.data tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .7rem 1rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }
  table.data tbody tr:hover {
    background: var(--surface);
  }
  table.data th,
  table.data td {
    padding: 0;
    border-bottom: 0;
    vertical-align: initial;
  }
  table.data td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: .18rem;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 600;
    line-height: 1.2;
  }
  table.data td.news-title-td {
    grid-column: 1 / -1;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.45;
    word-break: normal;
    overflow-wrap: anywhere;
  }
  .news-title-cell,
  .news-title-text {
    max-width: none;
  }
  .news-title-text {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }
  table.data td.news-title-td::before,
  table.data td.news-url-td::before,
  table.data td.news-actions-td::before {
    display: none;
  }
  table.data td.news-url-td {
    grid-column: 1 / -1;
    min-width: 0;
  }
  table.data td.news-meta-td,
  table.data td.news-status-td,
  table.data td.news-weight-td,
  table.data td.news-time-td {
    min-width: 0;
    color: var(--text);
    font-size: .85rem;
  }
  table.data td.news-time-td {
    white-space: normal;
  }
  table.data td.center,
  table.data td.num {
    text-align: left;
  }
  table.data td.news-actions-td {
    grid-column: 1 / -1;
    padding-top: .2rem;
  }
  .rowactions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .5rem;
  }
  .rowactions .btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .48rem .55rem;
    white-space: nowrap;
  }
}

@media (max-width: 760px) {
  .news-toolbar {
    grid-template-columns: 1fr;
  }
  .news-toolbar .news-new {
    width: 100%;
    min-width: 0;
  }
  .news-filterbar {
    display: grid;
    grid-template-columns: 1fr;
  }
  .filter-cat {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }
  .filter-cat select {
    min-width: 180px;
  }
  table.data tbody tr {
    grid-template-columns: 1fr 1fr;
  }
  table.data td.news-title-td,
  table.data td.news-url-td,
  table.data td.news-actions-td {
    grid-column: 1 / -1;
  }
  .rowactions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ============================================================
   Vault-inspired interface refresh
   Neutral surfaces, dark utility bar and a precise blue accent.
   ============================================================ */
:root {
  --purple: #1769ff;
  --purple-dark: #0b57d0;
  --purple-darker: #0847ad;
  --purple-light: #73a3ff;
  --purple-tint: #e8f0ff;
  --purple-tint2: #f2f6ff;
  --sidebar-bg: #f7f7f8;
  --sidebar-text: #2f333a;
  --sidebar-hover: #eceef1;
  --bg: #ffffff;
  --surface: #ffffff;
  --border: #d5d8de;
  --border-soft: #e8eaee;
  --text: #202124;
  --muted: #626873;
  --danger: #c62828;
  --danger-soft: #f2b8b5;
  --ok: #127a47;
  --radius: 5px;
  --shadow: 0 1px 2px rgba(18, 22, 33, .08), 0 5px 14px rgba(18, 22, 33, .04);
}

html { min-height: 100%; background: #fff; }
body {
  min-height: 100vh;
  color: var(--text);
  background: #fff;
  font-size: 15px;
  letter-spacing: .005em;
}
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { transition: border-color .14s ease, background-color .14s ease, color .14s ease, box-shadow .14s ease; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid #1769ff;
  outline-offset: 2px;
}

/* Application shell */
.layout {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  grid-template-rows: 68px minmax(calc(100vh - 68px), auto);
  min-height: 100vh;
  background: #fff;
}
.app-body { display: contents; }
.topbar {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  height: 68px;
  padding: 0 20px;
  color: #fff;
  background: #0d0d0f;
  border-bottom: 1px solid #353941;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  color: #fff;
  text-decoration: none;
  font-weight: 720;
  font-size: 1.05rem;
  letter-spacing: .02em;
}
.topbar-brand img { width: 46px; height: 46px; object-fit: contain; }
.topbar-help {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid #555b66;
  border-radius: 5px;
  color: #f7f7f8;
  font-weight: 700;
  cursor: help;
}
.topbar-help:hover { border-color: #8c929d; background: #202126; }
.user-menu { position: relative; }
.user-btn {
  min-height: 44px;
  padding: 4px 8px 4px 5px;
  gap: .55rem;
  color: #f8f8f9;
  background: transparent;
  border: 1px solid #555b66;
  border-radius: 5px;
}
.user-btn:hover { color: #fff; background: #202126; border-color: #8c929d; }
.user-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 3px;
  color: #fff;
  background: #6f52a3;
  font-size: .78rem;
  font-weight: 800;
}
.user-copy { display: flex; min-width: 78px; flex-direction: column; align-items: flex-start; line-height: 1.12; }
.user-copy strong { font-size: .82rem; font-weight: 650; }
.user-copy small { margin-top: 3px; color: #aeb3bc; font-size: .65rem; }
.user-btn .caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-left: .2rem;
  color: #fff;
}
.user-btn .caret::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform .16s ease;
}
.user-btn[aria-expanded="true"] .caret::before { transform: rotate(225deg); }
.user-dropdown {
  top: calc(100% + 8px);
  min-width: 178px;
  padding: .4rem;
  border-color: #c6cad1;
  border-radius: 4px;
  box-shadow: 0 12px 28px rgba(13, 13, 15, .2);
}
.user-dropdown button,
.user-dropdown form button[type=submit] {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 42px;
  margin: 0;
  padding: .62rem .72rem;
  color: #202124;
  background: transparent;
  border: 0;
  border-radius: 3px;
  box-shadow: none;
  font-size: .85rem;
  font-weight: 500;
  line-height: 1.2;
}
.user-dropdown form { width: 100%; margin: 0; }
.user-dropdown button:hover,
.user-dropdown form button[type=submit]:hover {
  color: #0b57d0;
  background: #edf3ff;
  border: 0;
  box-shadow: none;
}

.sidebar {
  grid-column: 1;
  grid-row: 2;
  width: 264px;
  height: calc(100vh - 68px);
  color: var(--sidebar-text);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 68px;
  z-index: 20;
}
.sidebar .brand {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: 1.65rem 1.4rem 1.15rem;
  color: #1d1f24;
  background: transparent;
  border: 0;
}
.brand-kicker,
.nav-section-label {
  color: #737985;
  font-size: .65rem;
  line-height: 1;
  font-weight: 750;
  letter-spacing: .13em;
}
.sidebar .brand strong { font-size: 1rem; font-weight: 680; }
.nav-section-label { padding: .65rem 1.4rem .45rem; }
.sidebar .nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  padding: 1.25rem .8rem 1rem;
}
.sidebar .nav a {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 20px;
  align-items: center;
  gap: .7rem;
  min-height: 44px;
  padding: .65rem .75rem;
  color: #22252a;
  border-radius: 4px;
  position: relative;
  font-size: .9rem;
}
.nav-group { display: flex; flex-direction: column; }
.nav-group-toggle {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 20px;
  align-items: center;
  gap: .7rem;
  width: 100%;
  min-height: 44px;
  padding: .65rem .75rem;
  color: #22252a;
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  font-size: .9rem;
  text-align: left;
}
.nav-group-toggle:hover { color: #111216; background: #eceef1; }
.nav-group.active > .nav-group-toggle { color: #0b57d0; font-weight: 650; }
.nav-group-toggle .nav-arrow::before { transform: rotate(45deg); }
.nav-group-toggle[aria-expanded="false"] .nav-arrow::before { transform: rotate(-45deg); }
.nav-subnav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: .15rem 0 .3rem 1.38rem;
  padding-left: .72rem;
  border-left: 1px solid #d1d5dc;
}
.nav-subnav[hidden] { display: none; }
.sidebar .nav .nav-subitem {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  min-height: 38px;
  padding: .5rem .65rem;
  gap: .55rem;
  font-size: .84rem;
}
.sidebar .nav .nav-subitem::before { display: none; }
.nav-subdot {
  width: 5px;
  height: 5px;
  margin-top: 1px;
  border-radius: 50%;
  background: #a2a7b0;
}
.sidebar .nav .nav-subitem.active { color: #0b57d0; background: #e9eaed; }
.sidebar .nav .nav-subitem.active .nav-subdot { background: #1769ff; box-shadow: 0 0 0 3px #d8e5ff; }
.sidebar .nav a::before {
  content: "";
  width: 3px;
  position: absolute;
  inset: 0 auto 0 -13px;
  background: transparent;
}
.sidebar .nav a:hover { color: #111216; background: #eceef1; }
.sidebar .nav a.active { color: #0b57d0; background: #e9eaed; font-weight: 650; }
.sidebar .nav a.active::before { background: #1769ff; }
.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}
.nav-icon svg { display: block; width: 20px; height: 20px; }
.nav-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  width: 20px;
  height: 20px;
  color: #666c75;
  font-size: 0;
  line-height: 1;
}
.nav-arrow::before {
  content: "";
  display: block;
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform .14s ease;
}
.main {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  padding: 44px clamp(28px, 4vw, 64px) 56px;
  background:
    radial-gradient(circle at 8% 0%, rgba(255, 239, 184, .34), transparent 26rem),
    radial-gradient(circle at 30% 4%, rgba(235, 221, 246, .22), transparent 24rem),
    #fff;
}
.main > h1 {
  margin: 0 0 1.55rem;
  color: #101114;
  font-size: clamp(1.7rem, 2.4vw, 2.2rem);
  line-height: 1.2;
  font-weight: 730;
  letter-spacing: -.025em;
}
h2 { border-bottom-color: var(--border); }
h3 { color: #343840; }
/* Components */
.note {
  padding: .85rem 1rem;
  color: #4c4a43;
  background: #fffaf0;
  border: 1px solid #eadfbe;
  border-left: 3px solid #d2a537;
  border-radius: 4px;
  line-height: 1.6;
}
.note code { color: #30343b; background: #f1eee5; }
.filterbar,
.userform,
.news-edit-top {
  padding: 1rem;
  border-color: #cfd3da;
  border-radius: 4px;
  box-shadow: none;
}
.filterbar label { display: inline-flex; align-items: center; gap: .45rem; color: #3d424a; font-weight: 560; }
.filterbar input,
.filterbar button,
.filterbar button[type="submit"],
.filterbar button.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 1;
}
.filterbar input { padding-right: .65rem; padding-left: .65rem; }
.filterbar button,
.filterbar button[type="submit"] { padding-right: 1rem; padding-left: 1rem; }
.filterbar input,
.userform input,
.news-toolbar #q,
.filter-cat select,
.news-edit-top input[type="text"],
.news-edit-top input[type="number"],
.news-edit-top select,
.lang-panel input,
.lang-panel textarea,
.author-form-field input,
.modal-card input,
textarea.full,
.addbar input,
.permeditor select {
  border-color: #929aa8;
  border-radius: 4px;
  background-color: #fff;
}
.filterbar input:focus,
.userform input:focus,
.news-toolbar #q:focus,
.filter-cat select:focus,
.news-edit-top input:focus,
.news-edit-top select:focus,
.lang-panel input:focus,
.lang-panel textarea:focus,
.author-form-field input:focus,
.modal-card input:focus,
textarea.full:focus,
.addbar input:focus,
.permeditor select:focus {
  outline: none;
  border-color: #1769ff;
  box-shadow: 0 0 0 2px rgba(23, 105, 255, .2);
}
.filterbar button,
.btn-primary,
form button[type=submit] {
  color: #fff;
  background: #1769ff;
  border: 1px solid #0d59e5;
  border-radius: 4px;
  box-shadow: 0 1px 1px rgba(11, 87, 208, .16);
  font-weight: 620;
}
.filterbar button:hover,
.btn-primary:hover,
form button[type=submit]:hover { color: #fff; background: #0b57d0; border-color: #0847ad; }
.btn-sm,
.filterbar button.btn-secondary {
  color: #353942;
  background: #fff;
  border-color: #9ca2ac;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(18, 22, 33, .08);
  font-weight: 560;
}
.btn-sm:hover,
.filterbar button.btn-secondary:hover { color: #0b57d0; background: #f5f8ff; border-color: #1769ff; }
.tablewrap {
  background: #fff;
  border-color: #cfd3da;
  border-radius: 4px;
  box-shadow: none;
}
table.data { font-size: .84rem; }
table.data th,
table.data td { padding: .72rem .78rem; border-color: #e0e3e8; }
table.data th {
  color: #3b3f47;
  background: #f1f2f4;
  font-weight: 680;
}
table.data tbody tr:hover { background: #f6f8fb; }
table.data details summary,
.username-action,
.news-title-text:hover { color: #0b57d0; }
.floating-table-head {
  position: fixed;
  display: block;
  overflow: hidden;
  z-index: 35;
  background: #f1f2f4;
  border: 1px solid #cfd3da;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  box-shadow: 0 4px 9px rgba(18, 22, 33, .12);
  pointer-events: none;
}
.floating-table-head[hidden] { display: none; }
table.data.floating-table-head-table {
  margin: 0;
  table-layout: fixed;
  transform-origin: left top;
  will-change: transform;
}
table.data.floating-table-head-table th {
  position: static;
  box-sizing: border-box;
  overflow: hidden;
}
.skel-bar { background: linear-gradient(90deg, #e7e9ed 0%, #f5f6f7 50%, #e7e9ed 100%); background-size: 200% 100%; }
.badge,
.chip,
.lang-dot.on,
.news-url-langs a { color: #244f91; background: #e8f0ff; border-color: #c7d9ff; }
.news-tabs .tab:hover,
.news-tabs .tab.active { color: #0b57d0; }
.news-tabs .tab.active { border-bottom-color: #1769ff; }
.modal { background: rgba(13, 13, 15, .58); backdrop-filter: blur(2px); }
.modal-card,
.modal-card.author-modal-card { border: 1px solid #bfc4cc; border-radius: 5px; box-shadow: 0 22px 60px rgba(13, 13, 15, .26); }
.toast { top: 84px; border-radius: 4px; }

/* Login */
.main-plain { min-height: 100vh; padding: 0; background: #fff; }
.login-shell { display: flex; min-height: 100vh; flex-direction: column; }
.login-stage {
  display: flex;
  flex: 1;
  width: min(100% - 40px, 640px);
  margin: 0 auto;
  padding: clamp(42px, 8vh, 92px) 0 54px;
  flex-direction: column;
  justify-content: center;
}
.login-brand {
  display: flex;
  margin-bottom: 1.5rem;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.login-brand img { width: 112px; height: 112px; object-fit: contain; }
.login-heading { margin-bottom: 1.15rem; }
.login-heading h1 { margin: 0; color: #232529; font-size: clamp(1.75rem, 4vw, 2.2rem); letter-spacing: -.02em; }
.login-card {
  max-width: none;
  margin: 0;
  padding: 1.65rem 1.7rem 1.75rem;
  background: #fff;
  border: 1px solid #cbd0d7;
  border-top: 1px solid #cbd0d7;
  border-radius: 5px;
  box-shadow: var(--shadow);
}
.login-card form { gap: 1.1rem; margin: 0; }
.login-card label { gap: .45rem; color: #202124; font-size: .86rem; font-weight: 650; }
.login-card input {
  min-height: 46px;
  padding: .7rem .8rem;
  color: #202124;
  background: #fff;
  border: 1px solid #8992a1;
  border-radius: 4px;
}
.login-card input::placeholder { color: #8a909a; }
.login-card input:focus { border-color: #1769ff; box-shadow: 0 0 0 2px rgba(23, 105, 255, .2); }
.login-card button {
  min-height: 46px;
  margin-top: .2rem;
  padding: .7rem 1rem;
  background: #1769ff;
  border: 1px solid #0d59e5;
  border-radius: 4px;
  font-weight: 680;
}
.login-card button:hover { background: #0b57d0; }
.login-card .err { margin: -.25rem 0 0; padding: .65rem .75rem; background: #fff1f0; border: 1px solid #f1b8b5; border-radius: 4px; }
.login-help { margin: 1rem 0 0; color: #626873; text-align: center; font-size: .86rem; }
.login-footer {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin: 0 38px;
  padding: 1.4rem 0 1.7rem;
  color: #69707c;
  border-top: 1px solid #d7dae0;
  font-size: .78rem;
}

/* Keep data grids useful on medium-width screens. */
@media (min-width: 901px) and (max-width: 1180px) {
  .tablewrap { overflow-x: auto; background: #fff; border: 1px solid var(--border); border-radius: 4px; }
  table.data { display: table; border-collapse: collapse; }
  table.data thead { display: table-header-group; }
  table.data tbody { display: table-row-group; }
  table.data tr,
  table.data tbody tr { display: table-row; padding: 0; background: transparent; border: 0; box-shadow: none; }
  table.data th,
  table.data td { display: table-cell; padding: .72rem .78rem; border-bottom: 1px solid var(--border-soft); }
  table.data td::before { display: none; }
  .rowactions { display: flex; }
}

@media (max-width: 900px) {
  .floating-table-head { display: none !important; }
  .layout {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 60px auto minmax(calc(100vh - 60px), auto);
  }
  .topbar { grid-column: 1; grid-row: 1; height: 60px; padding: 0 12px; }
  .topbar-brand img { width: 40px; height: 40px; }
  .topbar-brand span { display: none; }
  .topbar-help { display: none; }
  .user-copy { display: none; }
  .user-btn { min-height: 40px; }
  .sidebar {
    grid-column: 1;
    grid-row: 2;
    display: block;
    width: 100%;
    height: auto;
    position: sticky;
    top: 60px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
  }
  .sidebar .brand,
  .nav-section-label { display: none; }
  .sidebar .nav {
    display: flex;
    padding: .45rem .65rem;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: .3rem;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .sidebar .nav::-webkit-scrollbar { display: none; }
  .sidebar .nav a {
    display: inline-flex;
    min-height: 38px;
    padding: .5rem .72rem;
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .sidebar .nav .nav-group { display: contents; }
  .sidebar .nav .nav-group-toggle { display: none; }
  .sidebar .nav .nav-subnav {
    display: contents;
    margin: 0;
    padding: 0;
    border: 0;
  }
  .sidebar .nav .nav-subitem {
    display: inline-flex;
    min-height: 38px;
    padding: .5rem .72rem;
    gap: 0;
  }
  .nav-subdot { display: none; }
  .sidebar .nav a::before,
  .nav-icon,
  .nav-arrow { display: none; }
  .main { grid-column: 1; grid-row: 3; padding: 28px 18px 42px; }
}

@media (max-width: 560px) {
  .main > h1 { margin-bottom: 1.15rem; font-size: 1.55rem; }
  .filterbar { align-items: stretch; gap: .7rem; }
  .filterbar label { justify-content: space-between; width: 100%; }
  .filterbar input { min-width: 0; flex: 1; }
  .filterbar button { flex: 1; min-height: 40px; }
  .login-stage { width: min(100% - 28px, 640px); padding-top: 28px; }
  .login-brand img { width: 92px; height: 92px; }
  .login-card { padding: 1.3rem 1.1rem 1.4rem; }
  .login-footer { margin: 0 18px; gap: .35rem 1rem; flex-wrap: wrap; }
}
