* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; background: #f5f6f8; color: #1f2329; }
.hidden { display: none !important; }

/* 登录 */
.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: #0f172a; }
.login .card { background: #fff; padding: 32px 28px; border-radius: 12px; width: 300px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.login h1 { font-size: 18px; margin: 0 0 18px; text-align: center; }
.login input { width: 100%; padding: 10px; border: 1px solid #d0d5dd; border-radius: 8px; margin-bottom: 12px; font-size: 14px; }
.login button { width: 100%; padding: 10px; border: 0; border-radius: 8px; background: #22d7ee; color: #04212a; font-weight: 700; cursor: pointer; }
.err { color: #e5484d; font-size: 13px; min-height: 18px; margin: 6px 0 0; text-align: center; }

/* 布局 */
.topbar { height: 52px; background: #111827; color: #fff; display: flex; align-items: center; padding: 0 18px; gap: 16px; }
.topbar a { color: #22d7ee; text-decoration: none; }
.topbar #logout { margin-left: auto; background: transparent; border: 1px solid #374151; color: #cbd5e1; padding: 6px 12px; border-radius: 6px; cursor: pointer; }
.main { display: flex; height: calc(100vh - 52px); }

/* 模块树（手风琴用 <details>） */
.tree { width: 280px; background: #fff; border-right: 1px solid #e5e7eb; overflow-y: auto; padding: 10px; }
.tree details { margin-bottom: 4px; }
.tree summary { cursor: pointer; font-weight: 600; padding: 8px 10px; border-radius: 6px; background: #f1f5f9; user-select: none; }
.tree .item { padding: 7px 10px 7px 24px; cursor: pointer; border-radius: 6px; font-size: 14px; }
.tree .item:hover { background: #e0f7fb; }
.tree .item.active { background: #22d7ee; color: #04212a; font-weight: 600; }

/* 编辑器 */
.editor { flex: 1; display: flex; flex-direction: column; padding: 14px; gap: 10px; }
.bar { display: flex; align-items: center; gap: 10px; }
.cur { font-size: 13px; color: #6b7280; }
.spacer { flex: 1; }
.bar button { padding: 8px 14px; border: 1px solid #d0d5dd; border-radius: 8px; background: #fff; cursor: pointer; font-size: 14px; }
.bar button.primary { background: #22d7ee; border-color: #22d7ee; color: #04212a; font-weight: 700; }
.bar button:disabled { opacity: .6; cursor: default; }
#ta { flex: 1; width: 100%; resize: none; padding: 14px; border: 1px solid #d0d5dd; border-radius: 8px; font-family: "SFMono-Regular", Consolas, monospace; font-size: 14px; line-height: 1.6; }
.hint { font-size: 12px; color: #9ca3af; }
