/* AI 设计工坊 · 管理后台 —— 浅色主题 */
:root {
  --primary: #07C160;
  --primary-dark: #06a352;
  --primary-light: #e8f8ef;
  --danger: #e6432d;
  --danger-light: #fdecea;
  --warning: #f0a020;
  --warning-light: #fdf3e3;
  --info: #3a8ee6;
  --info-light: #ebf3fd;
  --text: #1f2329;
  --text-2: #4e5562;
  --text-3: #8a919f;
  --border: #e4e7ed;
  --bg: #f5f6f8;
  --card: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(31, 35, 41, .06), 0 1px 2px rgba(31, 35, 41, .04);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6;
}
a { color: var(--primary-dark); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; font-size: 14px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text);
  outline: none; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; min-height: 90px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* ---------- 登录页 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 400px; max-width: 100%; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 40px 36px; }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .mark { width: 56px; height: 56px; border-radius: 14px; background: var(--primary); color: #fff; font-size: 28px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.login-logo h1 { font-size: 20px; margin-top: 14px; }
.login-logo p { color: var(--text-3); font-size: 13px; margin-top: 4px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.field input { width: 100%; }
.field select { width: 100%; }
.field-hint { font-size: 12px; color: var(--text-3); margin-top: 6px; line-height: 1.5; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 8px; padding: 9px 18px; font-size: 14px;
  background: var(--primary); color: #fff; transition: background .15s;
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { background: #a9e6c6; cursor: not-allowed; }
.btn-block { width: 100%; padding: 11px; font-size: 15px; }
.btn-ghost { background: #fff; color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #c93522; }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 6px; }
.btn-link { background: none; border: none; color: var(--primary-dark); padding: 4px 6px; font-size: 13px; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }
.login-tip { text-align: center; color: var(--text-3); font-size: 12px; margin-top: 18px; }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--text-3); font-size: 12px; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.alert-error { background: var(--danger-light); color: var(--danger); }
.alert-ok { background: var(--primary-light); color: var(--primary-dark); }
.alert-info { background: var(--info-light); color: var(--info); }
.alert-warn { background: var(--warning-light); color: #b5730a; }

/* ---------- 应用骨架 ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 216px; background: var(--card); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.sidebar .brand .mark { width: 34px; height: 34px; border-radius: 9px; background: var(--primary); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-size: 17px; }
.sidebar .brand .name { font-weight: 600; font-size: 15px; }
.sidebar .brand .sub { font-size: 11px; color: var(--text-3); }
.nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--text-2); font-size: 14px; margin-bottom: 2px; }
.nav a:hover { background: var(--bg); color: var(--text); }
.nav a.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 500; }
.nav a .ico { width: 18px; text-align: center; }
.sidebar .foot { padding: 14px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); }
.main { flex: 1; margin-left: 216px; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 56px; background: var(--card); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 20; }
.topbar .page-title { font-size: 16px; font-weight: 600; }
.topbar .user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }
.topbar .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; }
.content { padding: 24px; flex: 1; }

/* ---------- 通用组件 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.card-title .extra { font-size: 13px; font-weight: 400; color: var(--text-3); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.stat-card .label { font-size: 12px; color: var(--text-3); }
.stat-card .value { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-card .foot { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.stat-card.accent .value { color: var(--primary-dark); }
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; padding: 10px 12px; color: var(--text-3); font-weight: 500; border-bottom: 1px solid var(--border); white-space: nowrap; background: #fafbfc; }
table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tr:hover td { background: #fafbfc; }
table.tbl tr:last-child td { border-bottom: none; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.ellipsis { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }
.tag { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 20px; font-size: 12px; line-height: 1.5; white-space: nowrap; }
.tag-green { background: var(--primary-light); color: var(--primary-dark); }
.tag-red { background: var(--danger-light); color: var(--danger); }
.tag-gray { background: #f0f2f5; color: var(--text-2); }
.tag-orange { background: var(--warning-light); color: #b5730a; }
.tag-blue { background: var(--info-light); color: var(--info); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 14px; border-radius: 20px; border: 1px solid var(--border); background: #fff; font-size: 13px; color: var(--text-2); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.empty { text-align: center; color: var(--text-3); padding: 48px 0; font-size: 13px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; line-height: 1.5; }
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 14px; font-size: 13px; color: var(--text-3); }
.loading { text-align: center; color: var(--text-3); padding: 40px 0; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(31, 35, 41, .45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 24px; }
.modal { background: #fff; border-radius: 14px; width: 480px; max-width: 100%; max-height: 86vh; overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,.18); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 15px; }
.modal-head .x { border: none; background: none; font-size: 18px; color: var(--text-3); padding: 2px 8px; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { word-break: break-all; }
.json-view { background: #f7f8fa; border: 1px solid var(--border); border-radius: 8px; padding: 12px; font-family: ui-monospace, Menlo, monospace; font-size: 12px; white-space: pre-wrap; word-break: break-all; max-height: 320px; overflow-y: auto; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* toast */
#toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast-item { background: #fff; border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.14); padding: 10px 18px; font-size: 13px; display: flex; gap: 8px; align-items: center; animation: drop .18s ease; }
.toast-item.ok { color: var(--primary-dark); }
.toast-item.err { color: var(--danger); }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

@media (max-width: 760px) {
  .sidebar { width: 64px; }
  .sidebar .brand .name, .sidebar .brand .sub, .nav a span.txt, .sidebar .foot { display: none; }
  .main { margin-left: 64px; }
  .content { padding: 14px; }
}
