:root {
  --bg: #faf7f2;
  --panel: #ffffff;
  --line: #ece6dd;
  --ink: #1f2328;
  --muted: #8a7f70;
  --accent: #e2622a;
  --accent-soft: #fff1e8;
  --ok: #1a7f37;
  --warn: #b45309;
  --danger: #c0392b;
  --shadow: 0 12px 40px rgba(80, 60, 30, 0.08);
}
* { box-sizing: border-box; }
/* 作者样式里的 display:grid/flex 会覆盖浏览器默认 [hidden]{display:none}，
   导致 modal / login / app 等带 hidden 的容器仍然显示。必须显式声明。 */
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; font-size: 14px; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 9px; background: #fff; color: var(--ink); outline: none; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
label { font-size: 12px; color: var(--muted); margin: 12px 0 5px; display: block; }

/* ---------- 登录：左侧示意图轮播 + 右侧登录框 ---------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 36px 32px;
  background:
    radial-gradient(900px 620px at 8% 4%, #fff3e4 0%, rgba(255, 243, 228, 0) 68%),
    radial-gradient(780px 560px at 96% 96%, #ffe7d9 0%, rgba(255, 231, 217, 0) 72%),
    var(--bg);
}
.login-shell {
  position: relative; width: min(1180px, 100%);
  display: grid; grid-template-columns: minmax(0, 1.42fr) 376px;
  gap: 52px; align-items: center;
}
.login-showcase { min-width: 0; }
.showcase-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.showcase-logo { width: 32px; height: 32px; border-radius: 9px; }
.showcase-brand { display: flex; align-items: baseline; gap: 8px; }
.showcase-brand b { font-size: 17px; }
.showcase-brand span { font-size: 12px; color: var(--muted); letter-spacing: .4px; }
.showcase-head-note { margin-left: auto; font-size: 12px; color: var(--muted); }
.showcase-stage {
  position: relative; width: 100%; aspect-ratio: 1280 / 800;
  border-radius: 20px; overflow: hidden; background: #f6efe6;
  border: 1px solid rgba(226, 98, 42, .14);
  box-shadow: 0 26px 58px rgba(90, 60, 30, .14);
}
.slide {
  position: absolute; inset: 0; margin: 0; opacity: 0; transform: scale(1.015);
  transition: opacity .4s ease, transform .55s ease; pointer-events: none;
}
.slide.is-active { opacity: 1; transform: scale(1); pointer-events: auto; }
.slide img { display: block; width: 100%; height: 100%; object-fit: cover; }
.showcase-foot {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-top: 18px; padding: 0 4px;
}
.slide-count { font-size: 11px; font-weight: 700; letter-spacing: 2px; color: var(--accent); }
.slide-caption { flex: 1 1 auto; min-width: 0; }
.slide-caption h2 { font-size: 18px; margin: 6px 0 4px; }
/* 说明保持单行：文案精简后不会被挤成两行，超窄屏用省略号兜底 */
.slide-caption p {
  margin: 0; max-width: 100%; color: var(--muted); font-size: 13px; line-height: 1.6;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.slide-nav { display: flex; flex: 0 0 auto; flex-direction: column; align-items: flex-end; gap: 12px; }
.slide-dots { display: flex; gap: 8px; }
.slide-dots button {
  width: 9px; height: 9px; padding: 0; border: 0; border-radius: 99px;
  background: #e3d8c9; transition: width .3s ease, background .3s ease;
}
.slide-dots button.is-active { width: 26px; background: var(--accent); }
.slide-progress { width: 120px; height: 3px; border-radius: 9px; background: #ecdfd1; overflow: hidden; }
/* 进度由 app.js 按真实计时推进（暂停/恢复不会和 CSS 动画脱节） */
.slide-progress span {
  display: block; width: 0; height: 100%; border-radius: 9px;
  background: var(--accent); transition: width .08s linear;
}
.login-wrap.is-paused .slide-progress span { opacity: .45; }

.login-pane { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.login-card {
  width: 100%; background: var(--panel); border: 1px solid var(--line);
  border-radius: 20px; padding: 32px 30px 26px;
  box-shadow: 0 18px 50px rgba(80, 60, 30, .10);
}
.login-brand { display: flex; align-items: center; gap: 10px; }
.login-brand img { width: 40px; height: 40px; border-radius: 11px; }
.login-brand div { display: flex; flex-direction: column; line-height: 1.25; }
.login-brand strong { font-size: 16px; }
.login-brand span { font-size: 11px; color: var(--muted); letter-spacing: .5px; }
.login-title { font-size: 24px; margin: 22px 0 4px; letter-spacing: .5px; }
.login-sub { color: var(--muted); font-size: 12.5px; margin: 0 0 6px; line-height: 1.6; }
.login-card input { background: #fcfaf7; }
.login-card input:focus { background: #fff; }
.login-card button {
  margin-top: 18px; width: 100%; border: 0; background: var(--accent); color: #fff;
  font-size: 15px; padding: 12px; border-radius: 12px;
}
.login-card button:hover { background: #d4571f; }
.login-card button:active { transform: translateY(1px); }
.login-card button:disabled { opacity: .65; cursor: wait; }
.login-err { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 18px; }
.login-secure {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--muted);
}
.secure-dot {
  display: inline-block; width: 6px; height: 6px; margin-right: 6px;
  border-radius: 50%; background: var(--ok); vertical-align: 1px;
}
.login-legal { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); }
.login-legal a { color: var(--muted); text-decoration: none; }
.login-legal a:hover { color: var(--accent); }

@media (max-width: 1000px) {
  .login-shell { grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; }
  .showcase-head-note { display: none; }
  .slide-caption p { font-size: 12px; }
  .slide-progress { width: 80px; }
}
/* 中等宽度把圆点/进度条挪到说明下方，给单行文案让出整行宽度 */
@media (max-width: 900px) and (min-width: 821px) {
  .showcase-foot { flex-direction: column; align-items: flex-start; gap: 10px; }
  .slide-nav { flex-direction: row; align-items: center; gap: 14px; }
  .slide-caption p { font-size: 11.5px; }
}
/* 窄屏只保留登录框：轮播脚本也会在 <=820px 时停掉定时器 */
@media (max-width: 820px) {
  .login-wrap { padding: 28px 18px; }
  .login-shell { grid-template-columns: 1fr; max-width: 400px; }
  .login-showcase { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .slide, .slide-dots button, .slide-progress span { transition: none; }
}

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh;
}
.brand { font-size: 20px; font-weight: 700; padding: 6px 10px 18px; }
.brand span { color: var(--accent); font-size: 13px; margin-left: 4px; font-weight: 500; }
.sidebar nav a {
  display: block; padding: 11px 12px; border-radius: 10px; color: var(--ink); text-decoration: none;
  margin-bottom: 4px; font-size: 14px;
}
.sidebar nav a:hover { background: var(--bg); }
.sidebar nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.me { font-size: 13px; color: var(--muted); margin-bottom: 8px; padding-left: 4px; }
.ghost { background: transparent; border: 1px solid var(--line); border-radius: 9px; padding: 9px; color: var(--muted); }
.ghost:hover { color: var(--ink); }

.content { flex: 1; padding: 26px 32px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.topbar h1 { font-size: 21px; margin: 0; }
.top-hint { color: var(--muted); font-size: 13px; }
.view { min-height: 60vh; }

/* ---------- 卡片/统计 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px;
  box-shadow: var(--shadow);
}
.card .num { font-size: 30px; font-weight: 700; }
.card .lbl { color: var(--muted); margin-top: 4px; }
.card .num.ok { color: var(--ok); }
.card .num.warn { color: var(--warn); }

/* ---------- 工具栏/表格 ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: flex-end; }
.toolbar .field { width: auto; min-width: 160px; }
.btn {
  border: 0; background: var(--accent); color: #fff; padding: 9px 16px; border-radius: 10px; font-size: 14px;
}
.btn:hover { filter: brightness(1.05); }
.btn.soft { background: var(--accent-soft); color: var(--accent); }
.btn.ghost-d { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
th, td { padding: 11px 13px; text-align: left; border-bottom: 1px solid var(--f4efe7, #f4efe7); font-size: 13.5px; }
th { background: #fdfbf7; color: var(--muted); font-weight: 600; font-size: 12.5px; }
tr:last-child td { border-bottom: 0; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.ok { background: #e7f6ec; color: var(--ok); }
.pill.warn { background: #fdf0dc; color: var(--warn); }
.pill.muted { background: #f1eee8; color: var(--muted); }
.pill.danger { background: #fbe7e4; color: var(--danger); }
button.pill { border: 0; cursor: pointer; font-family: inherit; }
button.pill:hover { filter: brightness(0.94); }

.pager { display: flex; gap: 8px; align-items: center; margin-top: 14px; }
.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px; }

/* ---------- 弹层 ---------- */
.modal { position: fixed; inset: 0; background: rgba(30, 22, 12, .4); display: grid; place-items: center; z-index: 50; }
/* 弹层统一样式：宽度占浏览器 80%，正文区独立滚动，操作按钮固定在右下角 */
.modal-box {
  background: #fff; border-radius: 16px; box-shadow: var(--shadow);
  width: 80vw; max-width: 80vw; max-height: 88vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 600; flex: 0 0 auto; }
.modal-head .x { border: 0; background: transparent; font-size: 22px; color: var(--muted); line-height: 1; }
.modal-body { padding: 20px; flex: 1 1 auto; overflow: auto; min-height: 0; }
/* 底部操作条：默认所有按钮靠右下；左侧需要「返回」这类导航按钮时放进 .foot-left */
.modal-foot { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); background: #fdfbf7; flex: 0 0 auto; }
.modal-foot .foot-left { margin-right: auto; }
.modal-foot:empty { display: none; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 180px; }
.nowrap { white-space: nowrap; }
td.nowrap .btn + .btn { margin-left: 6px; }
.modal-body table { margin-top: 4px; }
/* 弹层变宽后，单列表单控件不要被拉成一条长带 */
.modal-body > input, .modal-body > textarea, .modal-body > select { max-width: 560px; }
.modal-body th, .modal-body td { padding: 9px 10px; font-size: 13px; }
.note-preview { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 16px; line-height: 1.75; font-size: 14px; }
.note-preview p { margin: 0 0 8px; }
.note-preview p:last-child { margin-bottom: 0; }
.note-preview h3, .note-preview h4 { margin: 12px 0 6px; }
.note-preview ul { margin: 4px 0 8px; padding-left: 20px; }
.note-preview blockquote { margin: 6px 0; padding: 2px 12px; border-left: 3px solid var(--line); color: var(--muted); }
.note-preview a { color: var(--accent); text-decoration: none; border-bottom: 1px dashed currentColor; }
.note-preview .note-img { display: block; max-width: 100%; max-height: 60vh; margin: 8px 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: zoom-in; }
.note-preview code { background: var(--accent-soft); border-radius: 4px; padding: 1px 5px; font-size: 12.5px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: #1f2328; color: #fff;
  padding: 11px 18px; border-radius: 10px; font-size: 13.5px; z-index: 80; box-shadow: var(--shadow);
}
.tag { display: inline-block; background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 1px 7px; margin: 1px 3px 1px 0; font-size: 12px; }
.perm-group { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.perm-group h4 { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.perm-item { display: inline-flex; align-items: center; gap: 6px; margin: 4px 10px 4px 0; font-size: 13px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* ---------- 建议反馈 ---------- */
.nav-badge {
  float: right; min-width: 18px; padding: 1px 6px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 600;
  text-align: center; line-height: 16px;
}
.fb-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); margin-right: 6px; vertical-align: 1px; }
.fb-title { font-weight: 600; margin-bottom: 2px; }
.fb-preview { font-size: 12.5px; }
.fb-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.fb-thread { display: flex; flex-direction: column; gap: 8px; max-height: 48vh; overflow: auto; padding: 2px 2px 6px; }
/* pre-wrap 只放正文；放在 .fb-msg 会把模板换行渲染成空行，气泡被撑高 */
.fb-msg { max-width: 72%; padding: 7px 11px; font-size: 13px; line-height: 1.55; word-break: break-word; }
.fb-msg.user { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 12px 12px 12px 4px; }
.fb-msg.admin { align-self: flex-end; background: var(--accent-soft); border-radius: 12px 12px 4px 12px; }
.fb-meta { display: flex; align-items: baseline; gap: 6px; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.fb-meta span { font-size: 10.5px; opacity: .8; }
.fb-body { white-space: pre-wrap; }
.fb-check { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.fb-check input { width: auto; }
