/* 神草园内容智能中枢 · 样式（零构建，手写 CSS，无框架） */

:root {
  --accent: #0f766e;
  --accent-soft: #ccfbf1;
  --bg: #f7f8f7;
  --card: #ffffff;
  --text: #14181c;
  --muted: #6b7280;
  --line: #e5e7eb;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .05);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --card: #171a20; --text: #e8eaed; --muted: #9aa3af;
    --line: #2a2f38; --accent: #2dd4bf; --accent-soft: #134e4a;
    --danger-soft: #4c1d1d; --warn-soft: #45310f; --ok-soft: #14351f;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
        "Hiragino Sans GB", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: .01em; }
a { color: var(--accent); }
[hidden] { display: none !important; }

/* ─────────── 登录 ─────────── */
.login {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px;
}
.login form {
  width: 100%; max-width: 360px; background: var(--card); padding: 32px 24px;
  border-radius: 16px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 16px;
}
.logo { font-size: 40px; text-align: center; line-height: 1; }
.login h1 { font-size: 20px; text-align: center; }
.login .sub { margin: 0; text-align: center; color: var(--muted); font-size: 13px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); }
.field input {
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); outline: none; transition: border-color .15s;
}
.field input:focus { border-color: var(--accent); }

button { cursor: pointer; border: none; border-radius: 10px; padding: 12px 16px; background: var(--bg); transition: filter .15s, opacity .15s; }
button:active { filter: brightness(.94); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); color: #fff; font-weight: 600; }
button.ghost { background: transparent; color: var(--muted); padding: 6px 10px; font-size: 13px; }
button.ghost:hover { color: var(--text); }
button.mini { padding: 6px 10px; font-size: 13px; border-radius: 8px; }

.err { color: var(--danger); font-size: 13px; margin: 0; min-height: 1.2em; }

/* ─────────── 顶栏 ─────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 16px;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 650; display: flex; align-items: center; gap: 6px; }
.topbar .right { display: flex; align-items: center; gap: 10px; }
.who { font-size: 13px; color: var(--muted); }
.live { font-size: 22px; line-height: 1; color: var(--muted); transition: color .2s; }
.live.on { color: var(--ok); }
.live.off { color: var(--danger); }

/* ─────────── 导航 ─────────── */
.tabs {
  display: flex; gap: 4px; padding: 8px 12px;
  background: var(--card); border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  position: relative; white-space: nowrap; background: transparent;
  color: var(--muted); font-size: 14px; padding: 8px 12px; border-radius: 8px;
}
.tabs button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.badge {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 5px;
  background: var(--accent); color: #fff; border-radius: 9px;
  font-size: 11px; line-height: 18px; text-align: center; font-weight: 600;
}
.badge.warn { background: var(--warn); }

/* ─────────── 内容区 ─────────── */
.view { padding: 16px; max-width: 900px; margin: 0 auto; padding-bottom: calc(32px + var(--safe-b)); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.card h3 { font-size: 16px; margin-bottom: 4px; }
.card .meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.card .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.card p { margin: 8px 0 0; }

.sec-title { font-size: 13px; color: var(--muted); margin: 20px 0 8px; font-weight: 600; }
.sec-title:first-child { margin-top: 0; }

.empty { text-align: center; color: var(--muted); padding: 40px 16px; font-size: 14px; }
.loading { text-align: center; color: var(--muted); padding: 32px; }

.pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; background: var(--bg); border: 1px solid var(--line);
}
.pill.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.pill.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.pill.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }

/* 数据网格 */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 24px; font-weight: 700; margin-top: 2px; letter-spacing: -.02em; }
.stat .v small { font-size: 13px; font-weight: 500; color: var(--muted); }

/* 可点击卡片（工作台概览、提醒条） */
.clickable { cursor: pointer; transition: transform .1s ease, box-shadow .1s ease, border-color .1s ease; }
.clickable:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(16,24,40,.09); border-color: var(--accent); }
.clickable:active { transform: translateY(0); box-shadow: none; }

/* 维度条 */
.bar { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

/* 交付包的复制块 */
.block { border: 1px solid var(--line); border-radius: 10px; margin-top: 10px; overflow: hidden; }
.block header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; background: var(--bg); font-size: 13px; }
.block pre {
  margin: 0; padding: 12px; font-size: 13px; line-height: 1.7; white-space: pre-wrap;
  word-break: break-word; max-height: 260px; overflow: auto;
  font-family: inherit;
}

/* 表单 */
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.form-row > span { font-size: 13px; color: var(--muted); }
.form-row input, .form-row select, .form-row textarea {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
  outline: none; width: 100%;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--accent); }
.form-row textarea { min-height: 140px; resize: vertical; line-height: 1.7; }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .two { grid-template-columns: 1fr; } }

/* 提示条 */
.note {
  border-left: 3px solid var(--accent); background: var(--bg);
  padding: 10px 12px; border-radius: 0 8px 8px 0; font-size: 13px; color: var(--muted);
  margin: 10px 0;
}
.note.warn { border-color: var(--warn); }
.note.danger { border-color: var(--danger); }

/* Toast */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(24px + var(--safe-b)); z-index: 100;
  background: #14181c; color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.25);
  animation: pop .18s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, 8px); } }

.copy-fallback { position: fixed; left: -9999px; top: 0; opacity: 0; }

/* 公众号排版预览（始终白底，因为公众号本身就是白底） */
.preview {
  width: 100%; min-height: 420px; border: 1px solid var(--line);
  border-radius: 10px; background: #ffffff; margin-top: 10px;
  resize: vertical;
}

/* 事件流 */
.events { font-size: 12px; color: var(--muted); }
.events li { list-style: none; padding: 4px 0; border-bottom: 1px dashed var(--line); }

@media (max-width: 640px) {
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 6px 4px calc(6px + var(--safe-b));
    border-top: 1px solid var(--line); border-bottom: none;
    justify-content: space-around;
  }
  .tabs button { flex: 1; text-align: center; font-size: 12px; padding: 8px 2px; }
  .view { padding-bottom: calc(80px + var(--safe-b)); }
  .toast { bottom: calc(84px + var(--safe-b)); }
}

textarea{width:100%;box-sizing:border-box;font:inherit;line-height:1.7;resize:vertical;border:1px solid var(--line);border-radius:8px;padding:12px} .artifact-pre{white-space:pre-wrap;overflow-wrap:anywhere}details{margin:12px 0}details pre,.block pre{white-space:pre-wrap;overflow-wrap:anywhere;max-height:600px;overflow:auto}summary{cursor:pointer} .row input{min-width:180px;flex:1}
