:root {
  --ink: #1C2B24;
  --pine: #1F4E3D;
  --pine-dark: #152D23;
  --pine-soft: #E3EFE8;
  --clay: #D4653B;
  --clay-soft: #FCECE5;
  --linen: #F6F4EE;
  --paper: #FFFFFF;
  --muted: #7B847E;
  --line: #ECEAE2;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--linen);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; font-size: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--ink); }

/* 登录页 */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 20% 20%, #dce8e1 0%, #f6f4ee 60%);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 24px;
  padding: 36px 32px;
  border: 1px solid rgba(31,78,61,.08);
  box-shadow: 0 20px 50px rgba(24,42,34,.09);
}
.login-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 26px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.login-brand img { height: 44px; width: auto; display: block; }
.login-brand small { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.5px; }
.login-field { margin-bottom: 16px; }
.login-field label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 6px; color: #4A5750; }
.login-field input {
  width: 100%; padding: 11px 14px; border-radius: 12px;
  border: 1px solid rgba(28,43,36,.16); outline: none; transition: .15s;
}
.login-field input:focus { border-color: var(--pine); box-shadow: 0 0 0 3px rgba(31,78,61,.12); }

/* 后台主体布局 */
.layout { display: flex; min-height: 100vh; }
aside {
  width: 224px;
  background: linear-gradient(180deg, #19382C 0%, #12281F 100%);
  color: #F6F4EE;
  display: flex; flex-direction: column;
  padding: 24px 14px;
  position: sticky; top: 0; height: 100vh; flex-shrink: 0;
}
aside .brand {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  padding: 2px 10px 22px; margin-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,.09);
}
aside .brand img { height: 36px; width: auto; max-width: 172px; display: block; }
aside .brand small { font-size: 11px; color: #8CA59A; font-weight: 600; letter-spacing: 1px; }
aside nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
aside nav button {
  text-align: left; padding: 11px 14px; border-radius: 12px;
  font-size: 14px; font-weight: 600; color: #A9BFB5;
  display: flex; align-items: center; gap: 10px; transition: .15s;
}
aside nav button:hover { background: rgba(255,255,255,.07); color: #fff; }
aside nav button.on { background: #F6F4EE; color: #19382C; font-weight: 800; box-shadow: 0 4px 14px rgba(0,0,0,.14); }
aside nav button em {
  margin-left: auto; background: var(--clay); color: #fff;
  font-style: normal; font-size: 11px; font-weight: 800;
  border-radius: 99px; padding: 1px 8px; line-height: 18px;
}
aside .foot {
  border-top: 1px solid rgba(255,255,255,.1);
  padding: 14px 8px 0; font-size: 12px; color: #8CA59A;
  display: flex; justify-content: space-between; align-items: center;
}
aside .foot button { color: #C5DDD2; text-decoration: underline; font-size: 12px; }

main { flex: 1; min-width: 0; background: var(--linen); }
.ahd {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px;
  background: rgba(255,255,255,.88); backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(31,78,61,.08);
}
.ahd h2 { font-family: Georgia, "Songti SC", "PingFang SC", serif; font-size: 21px; font-weight: 900; }
.abody { padding: 24px 32px 60px; max-width: 1240px; }

/* 通用按钮与标签 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: 99px;
  background: var(--pine); color: #fff;
  font-weight: 700; font-size: 14px;
  box-shadow: 0 5px 14px rgba(31,78,61,.16); transition: .15s; white-space: nowrap;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.98); }
.btn.sm { padding: 6px 14px; font-size: 12px; box-shadow: 0 3px 10px rgba(31,78,61,.12); }
.btn.clay { background: var(--clay); box-shadow: 0 5px 14px rgba(212,101,59,.22); }
.btn.white { background: #fff; color: var(--ink); border: 1px solid rgba(28,43,36,.15); box-shadow: none; }
.btn.white:hover { background: #F3F6F4; border-color: rgba(31,78,61,.3); }
.btn.block { width: 100%; }

.tag {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: 99px; font-size: 11px; font-weight: 700;
  background: #EAF0EC; color: var(--pine); white-space: nowrap;
}
.tag.dark { background: var(--pine); color: #fff; }
.tag.lime { background: var(--pine-soft); color: var(--pine); }
.tag.orange { background: var(--clay-soft); color: #C85227; }
.tag.blue { background: #E8EFFC; color: #2B59C3; }
.tag.gray { background: #ECEAE4; color: var(--muted); }
.muted { color: var(--muted); font-size: 12px; }
.ops { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* KPI 与面板表格 */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 22px; }
.kpi {
  background: #fff; padding: 18px; border-radius: 18px;
  border: 1px solid rgba(31,78,61,.08);
  box-shadow: 0 8px 22px rgba(24,42,34,.04);
}
.kpi small { font-size: 12px; color: var(--muted); font-weight: 700; }
.kpi b { display: block; font-size: 28px; font-weight: 900; margin-top: 6px; }
.kpi:nth-child(1) { background: linear-gradient(135deg, #1F4E3D, #2D6A54); color: #fff; border: none; box-shadow: 0 10px 24px rgba(31,78,61,.2); }
.kpi:nth-child(1) small { color: #C5DDD2; }
.kpi:nth-child(3) b, .kpi:nth-child(4) b { color: var(--clay); }

.panel {
  background: #fff; border: 1px solid rgba(31,78,61,.08);
  border-radius: 18px; margin-bottom: 20px;
  box-shadow: 0 6px 20px rgba(24,42,34,.04); overflow: hidden;
}
.panel.vis { overflow: visible; }
.panel-h {
  padding: 14px 20px; font-weight: 800; font-size: 15px;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: #fff; border-radius: 17px 17px 0 0;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-size: 12px; color: #68736D; font-weight: 700;
  padding: 11px 16px; background: #F3F2EC; border-bottom: 1px solid #E5E3DA; white-space: nowrap;
}
td { padding: 12px 16px; border-bottom: 1px solid #F1EFE8; vertical-align: top; }
tr:last-child td { border-bottom: none; }
td .sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.empty { text-align: center; color: var(--muted); padding: 42px 0; font-size: 13px; }
.minibar { width: 110px; height: 7px; border-radius: 99px; background: #E8E6DE; overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 8px; }
.minibar i { display: block; height: 100%; background: linear-gradient(90deg, #2D6A54, #1F4E3D); border-radius: 99px; }
.ans { font-size: 12px; color: #4E5953; line-height: 1.6; background: #F6F5F0; border-radius: 10px; padding: 7px 10px; margin-top: 6px; }

/* 表单与编辑器 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; padding: 18px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label, .ed label { font-size: 12px; font-weight: 800; display: block; margin-bottom: 6px; color: #35443C; }
.form-grid input, .form-grid select, .ed input, .ed select, .sel {
  width: 100%; border: 1px solid rgba(28,43,36,.16); border-radius: 11px;
  padding: 9px 12px; background: #fff; outline: none; transition: .15s; font-weight: 600;
}
.sel { width: auto; }
.form-grid input:focus, .form-grid select:focus, .ed input:focus, .sel:focus {
  border-color: var(--pine); box-shadow: 0 0 0 3px rgba(31,78,61,.12);
}
.cover-up { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.cover-box {
  width: 248px; height: 132px; border: 1.5px dashed rgba(31,78,61,.3);
  border-radius: 16px; background: #FAF9F5;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; cursor: pointer; overflow: hidden; text-align: center; padding: 10px;
}
.cover-box:hover { background: #F0F4F1; border-color: var(--pine); }
.cover-box.has { border: 1px solid rgba(31,78,61,.12); padding: 0; }
.cover-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.qr-box { width: 112px; height: 112px; }

.swatch { display: inline-flex; gap: 6px; }
.swatch button { width: 38px; height: 24px; border-radius: 99px; border: 1.5px solid rgba(28,43,36,.15); }
.swatch button.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--pine); }
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opt { padding: 6px 12px; border: 1px solid rgba(28,43,36,.15); border-radius: 99px; font-size: 12px; font-weight: 700; background: #fff; }
.opt.on { background: var(--pine-soft); color: var(--pine); border-color: var(--pine); }

.rt-wrap { border: 1px solid rgba(28,43,36,.16); border-radius: 14px; overflow: hidden; background: #fff; }
.rt-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: #F3F2EC; border-bottom: 1px solid #E5E3DA; flex-wrap: wrap; }
.rt-bar button { padding: 5px 10px; border-radius: 8px; border: 1px solid rgba(28,43,36,.14); background: #fff; font-size: 12px; font-weight: 700; }
.rt-bar button:hover { background: var(--pine-soft); color: var(--pine); border-color: var(--pine); }
.rt-ed { min-height: 200px; max-height: 460px; overflow-y: auto; padding: 14px 16px; outline: none; font-size: 14px; line-height: 1.8; }
.rt-ed:empty::before { content: attr(data-ph); color: #999; pointer-events: none; }
.rt-ed img { max-width: 100%; height: auto; display: block; border-radius: 12px; margin: 10px 0; }
.rt-ed h3 { font-size: 16px; margin: 12px 0 6px; color: var(--ink); }
.rt-ed blockquote { border-left: 4px solid var(--pine); background: #F6F5F0; padding: 8px 12px; border-radius: 0 10px 10px 0; margin: 8px 0; color: #555; }
.rt-ed mark { background: var(--pine-soft); color: var(--pine); padding: 0 4px; border-radius: 4px; }

.ed-sess { border: 1px solid rgba(31,78,61,.12); border-radius: 16px; padding: 14px; margin-bottom: 14px; background: #FAF9F5; }
.ed-row { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 10px; flex-wrap: wrap; }
.ed-row > div { flex: 1; min-width: 120px; }
.lock-row { display: flex; align-items: center; gap: 10px; padding: 10px 20px; border-bottom: 1px dashed #E0E5E2; font-size: 13px; background: #F5F7F5; }
.lock-row b { width: 140px; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; padding: 12px 20px; border-bottom: 1px dashed #E5E3DA; align-items: center; }
.ed { padding: 12px 20px; border-bottom: 1px dashed #E5E3DA; }

.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 700; font-size: 13px; }
.toggle i { width: 40px; height: 22px; border-radius: 99px; background: #D2D9D5; position: relative; display: inline-block; }
.toggle i::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle.on i { background: var(--pine); }
.toggle.on i::after { left: 21px; }

/* 可视化弹出日历 */
.cal-wrap { position: relative; }
.cal-btn { display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; border: 1px solid rgba(28,43,36,.16); border-radius: 11px; padding: 8px 12px; background: #fff; font-weight: 700; font-size: 13px; }
.cal-btn.on { border-color: var(--pine); box-shadow: 0 0 0 3px rgba(31,78,61,.12); }
.cal-pop { position: absolute; top: calc(100% + 6px); left: 0; width: 288px; background: #fff; border: 1px solid rgba(31,78,61,.14); border-radius: 16px; box-shadow: 0 14px 36px rgba(20,36,28,.16); padding: 12px; z-index: 40; }
.cal-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-weight: 800; font-size: 14px; }
.cal-hd button { width: 28px; height: 28px; border: 1px solid rgba(28,43,36,.14); border-radius: 8px; background: #F6F4EE; font-weight: 800; }
.cal-hd button:hover { background: var(--pine-soft); color: var(--pine); }
.cal-wk, .cal-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; text-align: center; }
.cal-wk span { font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal-wk span.wknd { color: var(--clay); }
.cal-days button { height: 32px; border-radius: 8px; font-size: 13px; font-weight: 700; }
.cal-days button:hover:not([disabled]) { background: #EAF0EC; }
.cal-days button.in-rng { background: var(--pine-soft); color: var(--pine); }
.cal-days button.sel { background: var(--pine); color: #fff; box-shadow: 0 3px 8px rgba(31,78,61,.25); }
.cal-days button.today { text-decoration: underline; text-underline-offset: 3px; }
.cal-days button[disabled] { opacity: .25; pointer-events: none; }

.code-pill { font-family: Menlo, monospace; font-weight: 800; font-size: 13px; letter-spacing: 1.5px; background: #F3F2EC; padding: 3px 9px; border-radius: 8px; color: var(--pine); }

#toast {
  position: fixed; top: 24px; left: 50%; transform: translate(-50%, -20px);
  background: #19382C; color: #fff; padding: 10px 20px; border-radius: 99px;
  font-size: 13px; font-weight: 700; opacity: 0; transition: .25s;
  z-index: 999; pointer-events: none; box-shadow: 0 10px 26px rgba(24,42,34,.22);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
