:root {
  /* 翡翠绿（明亮清新） */
  --green-900: #0c7a51;   /* 深一档：用于文字/悬停，保证可读 */
  --green-800: #15a36b;   /* 主亮绿：按钮/标记/头像填充 */
  --green-700: #0e8f5e;   /* 中绿：链接/图标 */
  --green-600: #1aa97a;   /* 聚焦描边 */
  --green-soft: #e7f7ef;
  --green-soft-2: #cfeede;
  /* 文字 */
  --ink: #26302a;
  --ink-soft: #34403a;
  --text: #4f5249;
  --muted: #938b7b;
  --faint: #b3ab9a;
  /* 米色底与线 */
  --bg: #f3ecdf;
  --card: #fbf8f1;
  --card-2: #f7f2e8;
  --line: #e8e0d0;
  --line-2: #ddd3bf;
  /* 状态 */
  --ok: #15a36b;
  --ok-bg: #e7f7ef;
  --err: #b0533c;
  --err-bg: #f6e7df;
  --info: #3a6a8f;
  --info-bg: #e8f0f5;

  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(60,50,30,.05), 0 16px 44px -26px rgba(60,50,30,.30);
  --shadow-sm: 0 1px 2px rgba(60,50,30,.06);
  --serif: 'Georgia', 'Times New Roman', 'Songti SC', 'STSong', 'Noto Serif SC', serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green-700); text-decoration: none; }
a:hover { color: var(--green-900); }

/* 模板一：阳光气息渐变背景 */
body[data-theme="template1"] {
  background:
    radial-gradient(880px 520px at 86% -8%, rgba(255, 209, 102, .42), transparent 62%),
    radial-gradient(720px 480px at 8% 105%, rgba(102, 214, 158, .30), transparent 60%),
    linear-gradient(165deg, #fffaf0 0%, #fdf4e1 44%, #edf9f0 100%);
  background-attachment: fixed;
}
body[data-theme="template1"] .user-card { background: #fffefb; box-shadow: 0 1px 2px rgba(120,90,30,.05), 0 18px 50px -26px rgba(120,90,30,.28); }

/* ====== Logo 标记 ====== */
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--green-800); color: #f6f2e7; border-radius: 15px;
  box-shadow: 0 6px 16px -7px rgba(31,58,44,.6);
  font-weight: 800; letter-spacing: .03em; font-style: italic; line-height: 1;
}
.logo-mark svg { width: 56%; height: 56%; }
.user-brand .logo-mark { font-size: 17px; }
.login-card .logo-mark { font-size: 15px; }
.sidebar .logo .logo-mark { font-size: 11px; letter-spacing: .01em; }

/* ====== 通用控件 ====== */
.field { margin-bottom: 17px; }
.field label { display: block; font-size: 12.5px; color: var(--ink-soft); margin-bottom: 7px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  background: #fffdf8;
  transition: border-color .16s, box-shadow .16s;
  font-family: inherit;
  color: var(--ink);
}
.field input::placeholder, .field textarea::placeholder { color: #bcb4a3; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(21,163,107,.18);
}
.field textarea { resize: vertical; min-height: 72px; line-height: 1.6; }

.row { display: flex; gap: 13px; }
.row > * { flex: 1; }

button {
  cursor: pointer;
  border: 1px solid var(--green-800);
  border-radius: var(--radius-sm);
  padding: 11px 17px;
  font-size: 14px;
  font-weight: 600;
  background: var(--green-800);
  color: #f6f2e7;
  transition: background .15s, border-color .15s, color .15s, transform .08s;
  font-family: inherit;
}
button:hover { background: var(--green-900); border-color: var(--green-900); }
button:active { transform: translateY(.5px); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.ghost { background: #fffdf8; color: var(--ink-soft); border-color: var(--line-2); }
button.ghost:hover { background: var(--card-2); border-color: #cdc2ab; color: var(--ink); }
button.danger { background: #fffdf8; color: var(--err); border-color: #e3c4b6; }
button.danger:hover { background: var(--err-bg); border-color: #d5b09e; }
button.sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; padding: 13px; font-size: 15px; }

.msg { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 15px; font-weight: 500; }
.msg.ok { background: var(--ok-bg); color: var(--green-900); }
.msg.err { background: var(--err-bg); color: #9a4631; }
.msg.info { background: var(--info-bg); color: #2c5876; }

.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.hidden { display: none !important; }
.spin { display:inline-block; width:14px; height:14px; border:2px solid rgba(246,242,231,.45); border-top-color:#f6f2e7; border-radius:50%; animation: s .7s linear infinite; vertical-align:-2px; margin-right:7px; }
@keyframes s { to { transform: rotate(360deg); } }

/* ====== 用户下载页 ====== */
.user-page {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center;
  padding: 56px 16px 48px;
}
.user-brand { text-align: center; margin-bottom: 28px; }
.user-brand .logo-mark { width: 58px; height: 58px; margin-bottom: 16px; }
.user-brand h1 { font-family: var(--serif); margin: 0; font-size: 27px; font-weight: 700; letter-spacing: .01em; color: var(--ink); }
.user-brand p { margin: 10px 0 0; color: var(--muted); font-size: 14px; }

.user-card {
  width: 100%; max-width: 460px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.card-meta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 20px;
}
.card-meta span { background: var(--card-2); padding: 13px 15px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.card-meta b { color: var(--ink); font-size: 14.5px; font-weight: 700; }

.result-item {
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 15px 16px;
  margin-bottom: 11px;
  transition: border-color .16s, box-shadow .16s;
}
.result-item:hover { border-color: var(--green-soft-2); box-shadow: 0 0 0 3px rgba(21,163,107,.10); }
.result-item .name { font-weight: 700; word-break: break-all; margin-bottom: 4px; font-size: 14.5px; color: var(--ink); }
.result-item .sub { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.result-item .acts { display: flex; gap: 10px; }
.result-item .acts a { flex: 2; }
.result-item .acts a button { width: 100%; }
.result-item .acts > button { flex: 1; }

.user-foot { color: var(--faint); font-size: 12px; margin-top: 24px; max-width: 460px; text-align: center; line-height: 1.7; }

/* 多文件：全部下载工具条 */
.dl-allbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--green-soft); border: 1px solid var(--green-soft-2); }
.dl-allbar span { font-size: 13px; font-weight: 600; color: var(--green-900); }
.dl-allbar-btns { display: flex; gap: 8px; }
.dl-allbar-btns button { padding: 8px 13px; font-size: 13px; }
.t2-page .dl-allbar { background: #eaf1fc; border-color: #d4e2fb; }
.t2-page .dl-allbar span { color: #2563eb; }
.t2-page .dl-allbar-btns button:not(.ghost) { background: linear-gradient(135deg,#3b82f6,#2563eb); border: none; color: #fff; }
.t2-page .dl-allbar-btns button.ghost { background: #fff; border: 1px solid #dfe4ee; color: #4b5563; }

/* ====== 登录页 ====== */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 372px; background: var(--card); border-radius: var(--radius); padding: 34px 30px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.login-card .logo-mark { width: 52px; height: 52px; margin: 0 auto 18px; }
.login-card h1 { font-family: var(--serif); text-align: center; font-size: 21px; margin: 0 0 5px; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 24px; }

/* ====== 管理后台 · 侧边栏布局 ====== */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .logo { display: flex; align-items: center; gap: 11px; font-family: var(--serif); font-size: 18px; font-weight: 700; color: var(--ink); padding: 6px 8px 22px; }
.sidebar .logo .logo-mark { width: 34px; height: 34px; border-radius: 11px; }
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  background: transparent; color: var(--text); border: none;
  padding: 10px 12px; border-radius: 10px;
  font-size: 14px; font-weight: 600; text-align: left;
  transition: background .14s, color .14s;
}
.nav-item:hover { background: var(--card-2); color: var(--ink); }
.nav-item:active { transform: none; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--faint); transition: color .14s; }
.nav-item.active { background: var(--green-soft); color: var(--green-900); }
.nav-item.active svg { color: var(--green-700); }
.nav-item.active::before { content: ''; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--green-700); }

.sidebar-foot { border-top: 1px solid var(--line); padding-top: 15px; display: flex; flex-direction: column; gap: 9px; }
.sidebar-foot .user { display: flex; align-items: center; gap: 10px; padding: 2px 8px 9px; }
.sidebar-foot .avatar { width: 33px; height: 33px; border-radius: 9px; background: var(--green-800); color: #f6f2e7; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.sidebar-foot .user span:last-child { font-weight: 600; font-size: 14px; color: var(--ink); }
.sidebar-foot .foot-btns { display: flex; gap: 8px; }
.sidebar-foot .foot-btns button { flex: 1; }

.content { flex: 1; min-width: 0; padding: 26px 32px 40px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.topbar h2 { font-family: var(--serif); margin: 0; font-size: 23px; font-weight: 700; letter-spacing: .01em; color: var(--ink); }
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 6px; }

.panel { background: var(--card); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); border: 1px solid var(--line); }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 12px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--card-2); }
tbody tr:last-child td { border-bottom: none; }
td .pill, span.pill { display:inline-block; padding:3px 10px; border-radius:999px; font-size:12px; font-weight:600; }
.pill.on { background: var(--ok-bg); color: var(--green-900); }
.pill.off { background: var(--err-bg); color:#9a4631; }

.toolbar { display:flex; gap:10px; align-items:center; margin-bottom:18px; flex-wrap: wrap; }
.toolbar input, .toolbar select { padding:9px 12px; border:1px solid var(--line-2); border-radius:10px; font-size:13px; outline:none; background:#fffdf8; }
.toolbar input:focus { border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(21,163,107,.16); }
.codes-box { width:100%; height:160px; font-family: ui-monospace, monospace; font-size:12px; padding:12px; border:1px solid var(--line-2); border-radius:var(--radius-sm); resize:vertical; background:#fffdf8; }
code, .mono { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; }

/* 弹窗 */
.modal-bg { position: fixed; inset:0; background: rgba(38,48,42,.42); backdrop-filter: blur(3px); display:flex; align-items:center; justify-content:center; padding:16px; z-index: 50; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--card); border-radius: var(--radius); padding:24px; width:100%; max-width:520px; max-height: 90vh; overflow:auto; box-shadow: var(--shadow); animation: pop .18s ease; }
@keyframes pop { from { transform: translateY(8px) scale(.985); opacity: 0; } }
.modal h3 { font-family: var(--serif); margin-top:0; margin-bottom:18px; font-size:19px; color: var(--ink); }

/* ====== 主题选择（后台） ====== */
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.theme-card { position: relative; display: flex; flex-direction: column; gap: 13px; border: 1.5px solid var(--line-2); border-radius: var(--radius); padding: 14px; cursor: pointer; background: #fff; transition: border-color .15s, box-shadow .15s; }
.theme-card.selected { border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(21,163,107,.15); }
.theme-card input { position: absolute; opacity: 0; pointer-events: none; }
.theme-prev { height: 124px; border-radius: var(--radius-sm); padding: 16px; display: flex; flex-direction: column; gap: 9px; justify-content: center; border: 1px solid rgba(0,0,0,.05); }
.theme-prev .logo-mark, .tpv-badge { align-self: center; font-size: 12px; font-weight: 800; font-style: italic; padding: 7px 10px; border-radius: 9px; line-height: 1; margin-bottom: 4px; }
.tpv-bar { height: 9px; border-radius: 5px; background: rgba(0,0,0,.09); width: 82%; }
.tpv-bar.short { width: 56%; }
.tpv-btn { height: 18px; border-radius: 6px; width: 100%; margin-top: 5px; }
.tpv-1 { background: #f3ecdf; }
.tpv-1 .tpv-badge { background: #15a36b; color: #f6f2e7; }
.tpv-1 .tpv-btn { background: #15a36b; }
.tpv-2 { background: #eaf1fc; }
.tpv-2 .tpv-badge { background: #2f6fed; color: #fff; }
.tpv-2 .tpv-btn { background: linear-gradient(135deg,#3b82f6,#2563eb); }
.tpv-2 .tpv-bar { background: rgba(47,111,237,.18); }
.theme-name { font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.theme-desc { font-size: 12.5px; color: var(--muted); margin-top: 5px; line-height: 1.65; }
.theme-actions { display: flex; gap: 8px; margin-top: auto; }
.theme-actions a { flex: 1; } .theme-actions a button { width: 100%; } .theme-actions > button { flex: 1; }

/* ====== 模板二：分步工具台 ====== */
body[data-theme="template2"] { background: #eef1f6; }
.t2-page { min-height: 100vh; padding: 28px 16px 48px; }
.t2-wrap { max-width: 620px; margin: 0 auto; }
.t2-hero {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(120deg, #2f6fed 0%, #4f46e5 100%);
  color: #fff; border-radius: 18px; padding: 20px 22px; margin-bottom: 18px;
  box-shadow: 0 16px 40px -20px rgba(47,111,237,.6);
}
.t2-hero-logo .logo-mark { width: 50px; height: 50px; background: rgba(255,255,255,.18); color: #fff; box-shadow: none; backdrop-filter: blur(4px); }
.t2-hero-text { flex: 1; }
.t2-hero-text h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.t2-hero-text p { margin: 5px 0 0; font-size: 13px; opacity: .9; }
.t2-tag { background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.35); color: #fff; font-size: 12px; font-weight: 700; padding: 5px 11px; border-radius: 999px; }

.t2-card { background: #fff; border: 1px solid #e7ebf2; border-radius: 16px; margin-bottom: 16px; overflow: hidden; box-shadow: 0 1px 2px rgba(30,40,60,.04); }
.t2-head { display: flex; align-items: center; gap: 11px; padding: 15px 18px; border-bottom: 1px solid #f0f2f7; }
.t2-step { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg,#3b82f6,#2563eb); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; flex-shrink: 0; box-shadow: 0 6px 14px -6px rgba(47,111,237,.7); }
.t2-head h2 { margin: 0; font-size: 15.5px; font-weight: 700; color: #1f2733; }
.t2-body { padding: 16px 18px 18px; }

.t2-input { width: 100%; padding: 12px 14px; border: 1.5px solid #e2e6ee; border-radius: 11px; font-size: 14px; outline: none; background: #fafbfd; transition: border-color .16s, box-shadow .16s; font-family: inherit; color: #1f2733; }
.t2-input::placeholder { color: #abb2c0; }
.t2-input:focus { border-color: #2f6fed; background: #fff; box-shadow: 0 0 0 3px rgba(47,111,237,.13); }
textarea.t2-input { resize: vertical; min-height: 78px; line-height: 1.6; margin-bottom: 12px; }

.t2-go {
  width: 100%; padding: 14px; font-size: 15.5px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border: none; border-radius: 12px; cursor: pointer;
  box-shadow: 0 12px 26px -12px rgba(37,99,235,.8); transition: filter .15s, transform .08s;
}
.t2-go:hover { filter: brightness(1.05); }
.t2-go:active { transform: translateY(1px); }
.t2-go:disabled { opacity: .6; cursor: not-allowed; }

.t2-cardinfo { margin-top: 14px; }
.t2-ci-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: #eef1f6; border: 1px solid #eef1f6; border-radius: 11px; overflow: hidden; }
.t2-ci { background: #f8fafc; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.t2-ci span { font-size: 11.5px; color: #8b92a3; }
.t2-ci b { font-size: 14px; color: #1f2733; font-weight: 700; }
.t2-prog { margin-top: 13px; }
.t2-prog-top { display: flex; justify-content: space-between; font-size: 12.5px; color: #6b7280; margin-bottom: 7px; }
.t2-prog-top span:last-child { font-weight: 700; color: #2563eb; }
.t2-prog-track { height: 9px; background: #e8edf5; border-radius: 999px; overflow: hidden; }
.t2-prog-fill { height: 100%; background: linear-gradient(90deg,#3b82f6,#2563eb); border-radius: 999px; transition: width .4s ease; }

.t2-results { margin-top: 14px; }
.t2-results:empty { margin: 0; }
.t2-foot { text-align: center; color: #9aa1b0; font-size: 12px; margin-top: 22px; line-height: 1.7; }

/* 模板二下载结果项 + 按钮配色 */
.t2-page .result-item { border: 1px solid #e7ebf2; background: #fafbfd; }
.t2-page .result-item:hover { border-color: #c9d8f7; box-shadow: 0 0 0 3px rgba(47,111,237,.08); }
.t2-page .result-item .name { color: #1f2733; }
.t2-page .result-item .acts a button { background: linear-gradient(135deg,#3b82f6,#2563eb); border: none; color: #fff; }
.t2-page .result-item .acts a button:hover { filter: brightness(1.05); }
.t2-page .result-item .acts > button.ghost { background: #fff; border: 1px solid #dfe4ee; color: #4b5563; }
.t2-page .result-item .acts > button.ghost:hover { background: #f4f6fa; }

/* 响应式 */
@media (max-width: 820px) {
  .admin-layout { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: static; flex-direction: column; border-right: none; border-bottom: 1px solid var(--line); }
  .sidebar .logo { padding-bottom: 12px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-item { flex: 1; justify-content: center; }
  .nav-item.active::before { display: none; }
  .sidebar-foot { border-top: 1px solid var(--line); flex-direction: row; align-items: center; justify-content: space-between; margin-top: 10px; }
  .sidebar-foot .user { padding: 0; }
  .content { padding: 20px 16px 36px; }
  th, td { padding: 9px 7px; }
  .theme-grid { grid-template-columns: 1fr; }
}
