: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; }
.login-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 38px 30px; width: 340px; box-shadow: var(--shadow);
}
.login-logo { font-size: 26px; font-weight: 700; letter-spacing: .5px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 6px 0 4px; }
.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:active { transform: translateY(1px); }
.login-err { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 18px; }

/* ---------- 布局 ---------- */
.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; }
.modal-box { background: #fff; border-radius: 16px; width: min(680px, 92vw); max-height: 88vh; overflow: auto; box-shadow: var(--shadow); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 600; }
.modal-head .x { border: 0; background: transparent; font-size: 22px; color: var(--muted); line-height: 1; }
.modal-body { padding: 20px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 180px; }
.note-preview { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 16px; white-space: pre-wrap; line-height: 1.75; font-size: 14px; }

/* ---------- 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; }
