:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #1c1f23;
  --muted: #767d87;
  --line: #e6e8ec;
  --accent: #16181d;
  --green: #1f9d55;
  --green-bg: #e8f7ee;
  --amber: #b26b00;
  --amber-bg: #fdf3e2;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 700; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 15px; }
p { margin: 0; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.is-hidden { display: none !important; }

/* 布局 */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 216px; flex: 0 0 216px; background: #14161a; color: #c9ced7;
  display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 20px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; background: #fff; color: #14161a;
  display: grid; place-items: center; font-weight: 800; font-size: 16px;
}
.brand b { color: #fff; font-size: 14px; display: block; line-height: 1.3; }
.brand small { color: #7d8593; font-size: 11px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  color: #b6bcc7; font-size: 13.5px;
}
.nav a:hover { background: #1e2127; color: #fff; }
.nav a.on { background: #262a31; color: #fff; font-weight: 600; }
.nav .ico { width: 16px; text-align: center; opacity: .8; }
.side-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid #23262c; }
.side-foot .who { color: #fff; font-size: 13px; margin-bottom: 4px; }
.link { background: none; border: 0; padding: 0; color: #8f98a6; font-size: 12.5px; cursor: pointer; }
.link:hover { color: #fff; }
.link.danger { color: #c0392b; }
.main { flex: 1; padding: 24px 28px 60px; max-width: 1180px; }

/* 页头 */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.filters { display: flex; gap: 8px; }
.filters select, select, input[type=text], input[type=password], textarea {
  font-family: inherit; font-size: 13px; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; outline: none;
}
select:focus, input:focus, textarea:focus { border-color: #9aa2ae; }
textarea { resize: vertical; width: 100%; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-size: 13px; font-family: inherit; cursor: pointer;
  white-space: nowrap; transition: background .15s;
}
.btn:hover { background: #f0f1f3; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #2b2f36; }
.btn-sm { height: 29px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; height: 40px; }

/* 统计卡 */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.stat-row-sm { grid-template-columns: repeat(4, 1fr); }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 2px;
}
.stat-sm { padding: 12px 14px; }
.stat-label { color: var(--muted); font-size: 12.5px; }
.stat-num { font-size: 28px; line-height: 1.25; font-weight: 800; letter-spacing: -.5px; }
.stat-sm .stat-num { font-size: 20px; }
.stat-foot { color: var(--muted); font-size: 12px; }
.stat-accent { background: #14161a; border-color: #14161a; color: #fff; }
.stat-accent .stat-label, .stat-accent .stat-foot { color: #9aa2ae; }

/* 进度 */
.progress-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 18px; }
.progress { height: 8px; background: #eceef1; border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, #1f9d55, #47c97e); border-radius: 99px; }
.progress-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 12.5px; margin-top: 8px; }

/* 面板 */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; }
.empty { color: var(--muted); padding: 18px 0; text-align: center; }

/* 标签 */
.tag {
  display: inline-flex; align-items: center; height: 21px; padding: 0 7px; border-radius: 5px;
  background: #f0f1f3; color: #5b626c; font-size: 11.5px; white-space: nowrap;
}
.tag-v { background: var(--amber-bg); color: var(--amber); }
.tag-g { background: var(--green-bg); color: var(--green); }

/* 迷你卡片 */
.mini-card { border: 1px solid var(--line); border-radius: 10px; padding: 13px 14px; margin-bottom: 10px; }
.mini-card:last-child { margin-bottom: 0; }
.mini-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.slot { font-weight: 700; font-size: 12.5px; color: #14161a; }
.mini-title { font-weight: 650; font-size: 14px; margin-bottom: 4px; }
.mini-script { color: #4b5158; font-size: 13px; margin-bottom: 10px; }
.mini-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* 分布 */
.dist { display: flex; flex-direction: column; gap: 14px; }
.dist-label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 6px; }
.bar-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin-bottom: 6px; }
.bar-row span { width: 42px; color: #5b626c; }
.bar { flex: 1; height: 7px; background: #eceef1; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: #14161a; border-radius: 99px; }
.bar-row b { width: 26px; text-align: right; font-weight: 600; }
.quick { display: flex; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

/* 排期 */
.day-block { margin-bottom: 18px; }
.day-head {
  display: flex; align-items: center; gap: 10px; padding: 8px 2px; font-size: 13px; color: var(--muted);
}
.day-head b { color: var(--ink); font-size: 14px; }
.day-ver { background: #14161a; color: #fff; border-radius: 5px; padding: 0 7px; font-size: 11.5px; }
.day-count { margin-left: auto; font-size: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.card-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head .spacer { flex: 1; }
.topic-btn { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; }
.topic-btn:hover { color: var(--ink); text-decoration: underline; }
.chk { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: #4b5158; cursor: pointer; user-select: none; }
.chk input { width: 15px; height: 15px; accent-color: #1f9d55; cursor: pointer; }
.card-title { font-size: 15px; margin-bottom: 6px; line-height: 1.5; }
.card-script { color: #3f454c; font-size: 13.5px; margin-bottom: 8px; }
.card-meta { font-size: 12.5px; color: var(--muted); margin-bottom: 3px; }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 13px; }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.table tr:last-child td { border-bottom: 0; }
.table select { padding: 5px 8px; font-size: 12.5px; }
.row-focus { background: #f2f8f4; }

/* 素材库 */
.lib-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.lib-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; }
.lib-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.lib-body { margin: 0; font-family: inherit; font-size: 13px; color: #3f454c; white-space: pre-wrap; word-break: break-word; flex: 1; }
.lib-foot { margin-top: 10px; }

/* tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.tab {
  border: 1px solid transparent; background: none; font: inherit; font-size: 13px; color: var(--muted);
  padding: 6px 12px; border-radius: 8px; cursor: pointer;
}
.tab:hover { background: #eef0f2; }
.tab.on { background: #14161a; color: #fff; }
.tab-c { opacity: .65; font-size: 11.5px; }

/* 提示词 */
.prompt-layout { display: grid; grid-template-columns: 250px 1fr; gap: 16px; align-items: start; }
.prompt-list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; max-height: 76vh; overflow: auto; position: sticky; top: 20px; }
.pl-item { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; padding: 8px 10px; border-radius: 8px; font-size: 12.5px; }
.pl-item:hover { background: #f3f4f6; }
.pl-item.on { background: #14161a; color: #fff; }
.pl-item.on .pl-day, .pl-item.on .pl-ver { color: #9aa2ae; }
.pl-day { color: var(--muted); font-size: 11.5px; }
.pl-name { font-weight: 600; font-size: 13px; }
.pl-ver { grid-column: 2; color: var(--muted); font-size: 11.5px; }
.pl-done { grid-column: 2; color: var(--green); font-size: 11px; }
.prompt-main { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.pi-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.prompt-info h2 { font-size: 18px; margin-bottom: 6px; }
.prompt-info .sub { color: #4b5158; font-size: 13px; margin-bottom: 16px; }
.pane-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.prompt-text {
  width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px;
  line-height: 1.7; background: #fafbfc; border: 1px solid var(--line); border-radius: 9px; padding: 12px;
}

/* 模态 */
.modal {
  position: fixed; inset: 0; background: rgba(16,18,21,.45); display: none;
  align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal.on { display: flex; }
.modal-box { background: #fff; border-radius: 14px; padding: 20px; width: 100%; max-width: 520px; max-height: 88vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head .link { color: var(--muted); }
.modal-foot { margin-top: 16px; display: flex; justify-content: flex-end; }

/* 表单 */
.field { display: block; margin-bottom: 12px; }
.field .label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.field input[type=text], .field input[type=password], .field select { width: 100%; }

/* 复盘 */
.review-panel .field textarea { background: #fafbfc; }

/* 提示 */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: #14161a; color: #fff; padding: 9px 16px; border-radius: 9px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: all .2s; z-index: 80;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 登录 */
.auth-body { display: grid; place-items: center; min-height: 100vh; background: #14161a; }
.auth-card { width: 340px; background: #fff; border-radius: 16px; padding: 28px 26px; }
.auth-brand { padding: 0 0 20px; }
.auth-brand b { color: var(--ink); }
.auth-brand small { color: var(--muted); }
.hint { color: #c0392b; font-size: 12.5px; margin-top: 10px; min-height: 18px; }

@media (max-width: 900px) {
  .side { display: none; }
  .main { padding: 16px; }
  .grid-2, .lib-grid, .prompt-layout { grid-template-columns: 1fr; }
  .stat-row, .stat-row-sm { grid-template-columns: repeat(2, 1fr); }
  .prompt-list { position: static; max-height: 240px; }
}
