/* ============================================================
   基础样式 + 设计令牌
   默认令牌 = 云朵小狗（kids）风格，themes.css 里覆盖其余两套
   ============================================================ */

:root {
  --bg: #eef6ff;
  --bg-2: #fdf6fb;
  --surface: #ffffff;
  --surface-2: #f4f9ff;
  --surface-3: #e9f3ff;
  --border: #e2eefb;
  --text: #2a3f58;
  --text-soft: #56708e;
  --muted: #8fa8c2;
  --primary: #5cb6ea;
  --primary-ink: #ffffff;
  --primary-deep: #3f9ad2;
  --primary-shadow: #3f9ad2;
  --accent: #ff9dbb;
  --accent-soft: #ffe3ee;
  --ok: #46b98a;
  --warn: #f0a04b;
  --danger: #ef6b6b;
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 40px -22px rgba(92, 148, 200, .55), 0 2px 6px rgba(120, 165, 205, .08);
  --shadow-soft: 0 8px 22px -14px rgba(92, 148, 200, .6);
  --ring: 0 0 0 3px rgba(92, 182, 234, .28);
  --font: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: var(--font);
  --topbar-h: 70px;
  --ease: cubic-bezier(.22, .68, .36, 1);
}

* { box-sizing: border-box; }

/* 关键：让 hidden 属性永远生效（否则被 .preview-empty{display:flex} 之类覆盖） */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-image, none);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  transition: background-color .4s var(--ease), color .3s var(--ease);
  padding-bottom: 40px;
}

h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 800; letter-spacing: .2px; }
p { margin: 0; }
button { font-family: inherit; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .92em; background: var(--surface-3); padding: 2px 6px; border-radius: 6px; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon.big { width: 30px; height: 30px; stroke-width: 1.5; }

/* ------------------------------------------------------------ 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 0 clamp(16px, 4vw, 40px);
  background: var(--nav-bg, rgba(255, 255, 255, .78));
  backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  background: var(--surface); border-radius: 16px;
  box-shadow: var(--shadow-soft); border: 1px solid var(--border);
}
.brand-mark svg { width: 34px; height: 34px; }
.brand-text { min-width: 0; }
.brand h1 { font-size: 19px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 11.5px; color: var(--muted); letter-spacing: .4px; margin-top: 2px; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.status-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-soft); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .2s var(--ease);
}
.status-chip:hover { border-color: var(--primary); color: var(--text); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 3px rgba(143, 168, 194, .18); }
.dot.online { background: var(--ok); box-shadow: 0 0 0 3px rgba(70, 185, 138, .22); }
.dot.printing { background: var(--accent); box-shadow: 0 0 0 3px rgba(255, 157, 187, .28); animation: pulse 1.2s infinite; }
.dot.offline { background: var(--danger); box-shadow: 0 0 0 3px rgba(239, 107, 107, .2); }

.theme-switch {
  display: flex; gap: 6px; padding: 5px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.theme-switch button {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .2s;
}
.theme-switch button:nth-child(1) { background: linear-gradient(135deg, #b9e3ff, #ffd9e8); }
.theme-switch button:nth-child(2) { background: linear-gradient(135deg, #f4f5f7, #cfd6e0); }
.theme-switch button:nth-child(3) { background: linear-gradient(135deg, #f6e6d2, #d8a87f); }
.theme-switch button.active { transform: scale(1.12); box-shadow: var(--ring); border-color: #fff; }
.theme-switch button:hover { transform: translateY(-1px) scale(1.08); }

.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer;
  border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text-soft);
  transition: all .2s var(--ease);
}
.icon-btn:hover { color: var(--primary-deep); transform: rotate(-25deg); }
.icon-btn.spinning .icon { animation: spin .9s linear infinite; }

/* ------------------------------------------------------------ 任务条 */
.jobbar {
  position: sticky; top: var(--topbar-h); z-index: 35;
  background: var(--primary); color: var(--primary-ink);
  padding: 9px clamp(16px, 4vw, 40px);
  animation: slideDown .3s var(--ease);
}
.jobbar-inner { display: flex; align-items: center; gap: 14px; max-width: 1180px; margin: 0 auto; font-size: 13px; }
.jobbar-title { font-weight: 700; white-space: nowrap; }
.jobbar-track { flex: 1; height: 7px; border-radius: 999px; background: rgba(255, 255, 255, .35); overflow: hidden; }
.jobbar-track span { display: block; height: 100%; width: 0; border-radius: 999px; background: #fff; transition: width .45s var(--ease); }
.jobbar-pct { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 38px; text-align: right; }
.jobbar-cancel {
  border: 1px solid rgba(255, 255, 255, .6); background: transparent; color: inherit;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; cursor: pointer;
}
.jobbar-cancel:hover { background: rgba(255, 255, 255, .18); }

/* ------------------------------------------------------------ 导航 */
.tabs {
  display: flex; gap: 4px; padding: 10px clamp(16px, 4vw, 40px) 0;
  max-width: 1180px; margin: 0 auto; overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 11px 18px; border: none; background: transparent; cursor: pointer;
  color: var(--text-soft); font-size: 14px; font-weight: 700; border-radius: 999px;
  transition: all .2s var(--ease);
}
.tab .icon { width: 18px; height: 18px; }
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab.active { background: var(--surface); color: var(--primary-deep); box-shadow: var(--shadow-soft); }

/* ------------------------------------------------------------ 舞台/视图 */
.stage { max-width: 1180px; margin: 0 auto; padding: 18px clamp(16px, 4vw, 40px) 60px; }
.view { display: none; }
.view.active { display: block; animation: viewIn .38s var(--ease); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(18px, 2.4vw, 26px);
  position: relative;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h3 { font-size: 15.5px; }
.stamp {
  font-size: 11.5px; letter-spacing: .5px; color: var(--muted);
  padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px dashed var(--border);
  white-space: nowrap;
}
.hint { font-size: 12px; color: var(--muted); line-height: 1.7; margin-top: 12px; }
.lead { font-size: 13.5px; color: var(--text-soft); line-height: 1.8; margin-bottom: 18px; }
.eyebrow { font-size: 11px; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; margin-bottom: 8px; }

/* ------------------------------------------------------------ 概览 hero */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: stretch; }
.status-card { display: grid; grid-template-columns: 186px 1fr; gap: 20px; align-items: center; overflow: hidden; }
.status-visual { position: relative; display: grid; place-items: center; }
.mascot { width: 178px; height: 178px; animation: float 5s ease-in-out infinite; }
.mascot-svg { width: 100%; height: 100%; overflow: visible; }
.state-badge {
  position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
  padding: 5px 14px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  background: var(--accent-soft); color: #c2557d; white-space: nowrap;
  box-shadow: 0 4px 10px -6px rgba(0, 0, 0, .3);
}
.state-badge.is-offline { background: #fdecec; color: #c95252; }
.state-badge.is-busy { background: #fff2e0; color: #b9762b; }

.status-copy h2 { font-size: clamp(22px, 2.6vw, 30px); line-height: 1.25; }
.state-desc { margin-top: 8px; font-size: 13.5px; color: var(--text-soft); line-height: 1.75; min-height: 24px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.meta {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-soft);
  background: var(--surface-2); padding: 6px 11px; border-radius: 999px;
}
.meta b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.meta .icon { width: 14px; height: 14px; }
.status-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* 墨仓 */
.ink-card { display: flex; flex-direction: column; }
.tanks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; flex: 1; align-items: end; padding: 6px 0 2px; }
.tank { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tank-glass {
  position: relative; width: 100%; max-width: 58px; height: 132px;
  border-radius: 16px 16px 20px 20px; background: var(--surface-2);
  border: 2px solid var(--border); overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(120, 160, 200, .16);
}
.tank-glass::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, .55), transparent 42%);
  pointer-events: none;
}
.tank-cap {
  width: 26px; height: 9px; border-radius: 4px 4px 2px 2px;
  background: var(--border); margin-bottom: -4px;
}
.tank-fill {
  position: absolute; left: 0; right: 0; bottom: 0; height: 0;
  transition: height 1s var(--ease);
  border-radius: 0 0 16px 16px;
}
.tank-fill::before {
  content: ""; position: absolute; top: -3px; left: 0; right: 0; height: 7px;
  border-radius: 50%; background: inherit; opacity: .85;
}
.tank-name { font-size: 12px; color: var(--text-soft); font-weight: 700; }
.tank-pct { font-size: 12.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tank.is-low .tank-pct { color: var(--warn); }
.tank.is-empty .tank-pct { color: var(--danger); }
.tank.is-unknown .tank-pct { color: var(--muted); }

/* 快捷入口 */
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 18px; }
.quick {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  text-align: left; cursor: pointer; padding: 18px 20px;
  color: inherit; font: inherit;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s;
}
.quick:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--primary); }
.quick-icon {
  width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--primary-deep); margin-bottom: 8px;
}
.quick-title { font-weight: 800; font-size: 14.5px; }
.quick-sub { font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------ 通用表单元素 */
.split { display: grid; grid-template-columns: 1.05fr .95fr; gap: 18px; align-items: start; }
.stack { display: grid; gap: 18px; }

.seg {
  display: inline-flex; padding: 4px; gap: 4px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 16px;
}
.seg button {
  border: none; background: transparent; padding: 8px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 700; color: var(--text-soft); cursor: pointer;
  transition: all .2s var(--ease);
}
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-soft); }

textarea, input[type="text"], select {
  width: 100%; font-family: inherit; font-size: 14.5px; color: var(--text);
  background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: var(--radius-md); padding: 14px 16px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
textarea { min-height: 176px; line-height: 1.8; resize: vertical; }
textarea:focus, input[type="text"]:focus, select:focus { border-color: var(--primary); box-shadow: var(--ring); }

.presets { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.presets button {
  border: 1px dashed var(--border); background: transparent; color: var(--text-soft);
  font-size: 12px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
}
.presets button:hover { border-color: var(--primary); color: var(--primary-deep); }

.inline-field { margin-top: 16px; }
.inline-field label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.inline-field b { color: var(--text); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--primary); }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 34px 20px; border: 2px dashed var(--border); border-radius: var(--radius-md);
  background: var(--surface-2); color: var(--text-soft); cursor: pointer; text-align: center;
  transition: all .2s var(--ease);
}
.dropzone:hover, .dropzone.dragover { border-color: var(--primary); background: var(--surface-3); color: var(--primary-deep); }
.dropzone b { font-size: 14px; }
.dropzone span { font-size: 12px; color: var(--muted); }
.file-chip {
  display: flex; align-items: center; gap: 10px; margin-top: 12px;
  padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-3);
  font-size: 13px; word-break: break-all;
}
.file-chip img { width: 42px; height: 42px; object-fit: cover; border-radius: 8px; }

.options { display: grid; gap: 14px; margin: 18px 0; }
.options.vertical { gap: 16px; }
.options.vertical .opt { flex-direction: column; align-items: flex-start; gap: 8px; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.opt-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.small button { padding: 6px 12px; font-size: 12px; }
.chip-opt {
  border: 1.5px solid var(--border); background: var(--surface-2); color: var(--text-soft);
  padding: 8px 15px; border-radius: 999px; font-size: 12.5px; font-weight: 700; cursor: pointer;
  transition: all .18s var(--ease);
}
.chip-opt:hover { border-color: var(--primary); color: var(--primary-deep); }
.chip-opt.active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }

.stepper { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 999px; padding: 4px; }
.stepper button {
  width: 30px; height: 30px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--surface); color: var(--text); font-size: 17px; font-weight: 700; line-height: 1;
  box-shadow: var(--shadow-soft);
}
.stepper button:hover { background: var(--primary); color: var(--primary-ink); }
.stepper span { min-width: 26px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 12.5px; color: var(--text-soft); }
.switch input { display: none; }
.slider { width: 42px; height: 24px; border-radius: 999px; background: var(--border); position: relative; transition: background .2s; flex: none; }
.slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s var(--ease); }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::after { transform: translateX(18px); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: var(--radius-md); border: 1.5px solid transparent;
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: transform .16s var(--ease), box-shadow .2s, background .2s, color .2s;
}
.btn.primary { background: var(--primary); color: var(--primary-ink); box-shadow: var(--btn-shadow, 0 8px 20px -12px rgba(0,0,0,.35)); }
.btn.primary:hover { background: var(--primary-deep); transform: translateY(-1px); }
.btn.primary:active { transform: translateY(1px); }
.btn.ghost { background: var(--surface-2); color: var(--text-soft); border-color: var(--border); }
.btn.ghost:hover { color: var(--primary-deep); border-color: var(--primary); }
.btn.block { width: 100%; }
.btn.big { padding: 16px 22px; font-size: 15.5px; border-radius: var(--radius-md); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

.row-actions { display: flex; gap: 10px; margin-top: 16px; }
.row-actions.wrap { flex-wrap: wrap; }

.tip-box {
  display: flex; gap: 10px; align-items: flex-start; margin: 6px 0 18px;
  padding: 12px 14px; border-radius: var(--radius-md);
  background: var(--accent-soft); color: var(--text-soft); font-size: 12.5px; line-height: 1.7;
}
.tip-box .icon { color: var(--accent); margin-top: 2px; }

/* ------------------------------------------------------------ 未保存提示条 */
.save-bar {
  position: fixed; left: 50%; bottom: 18px; z-index: 60;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 12px 10px 18px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  animation: savebar-in .26s var(--ease);
}
.save-bar-text {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; color: var(--warn); white-space: nowrap;
}
.save-bar-text .icon { width: 16px; height: 16px; }
.save-bar-actions { display: flex; gap: 8px; }
.save-bar .btn { padding: 8px 16px; font-size: 13px; border-radius: 999px; }
.stamp.dirty { color: var(--warn); border-color: currentColor; }
@keyframes savebar-in { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 720px) {
  .save-bar {
    left: 10px; right: 10px; bottom: calc(72px + env(safe-area-inset-bottom));
    transform: none; gap: 10px; padding: 9px 10px 9px 14px;
  }
  .save-bar-text { font-size: 12px; }
  .save-bar .btn { padding: 8px 13px; font-size: 12.5px; }
}

/* ------------------------------------------------------------ 预览 */
.preview-stage { display: grid; place-items: center; padding: 6px 0 0; }
.preview-paper {
  width: 100%; max-width: 380px; aspect-ratio: 210 / 297;
  background: #fff; border-radius: 8px; box-shadow: 0 10px 30px -18px rgba(30, 60, 90, .55);
  display: grid; place-items: center; overflow: hidden; position: relative;
  border: 1px solid rgba(0, 0, 0, .06);
}
.preview-paper img { width: 100%; height: 100%; object-fit: contain; display: block; }
.preview-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); text-align: center; padding: 24px; font-size: 12.5px; }
.preview-empty .icon { color: var(--border); }

.scan-stage {
  min-height: 320px; border-radius: var(--radius-md); background: var(--surface-2);
  border: 1.5px dashed var(--border); display: grid; place-items: center; overflow: hidden; padding: 10px;
}
.scan-stage img { max-width: 100%; max-height: 460px; border-radius: 8px; box-shadow: var(--shadow-soft); }
.result-actions { display: flex; gap: 10px; margin-top: 14px; }
.result-actions a { text-decoration: none; }

/* ------------------------------------------------------------ 复印步骤 */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; opacity: .5; transition: opacity .3s; }
.steps li.active, .steps li.done { opacity: 1; }
.step-dot {
  width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--surface-2); border: 1.5px solid var(--border); font-size: 12.5px; font-weight: 800; color: var(--text-soft);
}
.steps li.active .step-dot { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); animation: pulse 1.4s infinite; }
.steps li.done .step-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.steps b { font-size: 13.5px; }
.steps p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.copy-preview { margin-top: 18px; text-align: center; }
.copy-preview img { max-width: 100%; max-height: 260px; border-radius: 8px; box-shadow: var(--shadow-soft); }

/* ------------------------------------------------------------ 任务列表 */
.job-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.job-item {
  display: grid; grid-template-columns: 38px 1fr auto; gap: 14px; align-items: center;
  padding: 14px 16px; border-radius: var(--radius-md); background: var(--surface-2);
  border: 1px solid transparent; transition: border-color .2s, background .2s;
}
.job-item:hover { border-color: var(--border); background: var(--surface); }
.job-icon {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface); color: var(--primary-deep); box-shadow: var(--shadow-soft);
}
.job-main { min-width: 0; }
.job-title { font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.job-progress { height: 4px; border-radius: 999px; background: var(--border); margin-top: 8px; overflow: hidden; }
.job-progress span { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .4s var(--ease); }
.job-right { display: flex; align-items: center; gap: 8px; }
.pill {
  font-size: 11.5px; font-weight: 800; padding: 5px 11px; border-radius: 999px; white-space: nowrap;
  background: var(--surface-3); color: var(--text-soft);
}
.pill.done { background: #e6f8ef; color: #23845f; }
.pill.failed { background: #fdecec; color: #c95252; }
.pill.running { background: var(--accent-soft); color: #b9527a; }
.pill.queued { background: #f0f0f5; color: #6b7280; }
.pill.canceled { background: #f3f4f6; color: #9ca3af; }
.job-link {
  border: none; background: transparent; color: var(--muted); cursor: pointer; padding: 4px;
  border-radius: 8px; display: grid; place-items: center;
}
.job-link:hover { color: var(--primary-deep); background: var(--surface); }

/* ------------------------------------------------------------ 设置 */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 7px; }
.field-row { display: grid; grid-template-columns: 1fr 96px; gap: 10px; }
.field > span { font-size: 12px; color: var(--muted); font-weight: 600; }
/* 首次打开、服务端要令牌时，把「访问令牌」那一格标出来（需要填完才消失） */
.field.attention { position: relative; }
.field.attention > span { color: var(--primary-deep); }
.field.attention input {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
  animation: field-pulse 1.6s ease-in-out infinite;
}
@keyframes field-pulse {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
  50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--primary) 8%, transparent); }
}
.discover-list { display: grid; gap: 8px; margin-top: 14px; }
.discover-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 12.5px;
}
.discover-item b { font-family: ui-monospace, monospace; }
.discover-item button {
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px;
  padding: 5px 12px; font-size: 11.5px; cursor: pointer; color: var(--primary-deep); font-weight: 700;
}

.theme-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-card {
  display: grid; gap: 4px; padding: 12px; border-radius: var(--radius-md); cursor: pointer;
  border: 1.5px solid var(--border); background: var(--surface-2); text-align: left;
  color: inherit; font: inherit;
  transition: all .2s var(--ease);
}
.theme-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.theme-card.active { border-color: var(--primary); box-shadow: var(--ring); background: var(--surface); }
.theme-card b { font-size: 12.5px; }
.theme-card small { font-size: 11px; color: var(--muted); }
.theme-swatch { height: 34px; border-radius: 9px; margin-bottom: 4px; display: block; }
.theme-swatch.kids { background: linear-gradient(120deg, #cfeaff, #ffe1ee 70%, #dff7ee); }
.theme-swatch.clean { background: linear-gradient(120deg, #f7f8fa, #dfe3ea); }
.theme-swatch.warm { background: linear-gradient(120deg, #f8ecdc, #e2c3a4); }

.kv { margin: 0; display: grid; gap: 8px; }
.kv div { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: ui-monospace, monospace; color: var(--text-soft); text-align: right; word-break: break-all; }

/* ------------------------------------------------------------ toast */
.toast-wrap { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; width: min(92vw, 460px); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 14px;
  background: rgba(30, 42, 56, .94); color: #fff; font-size: 13px; line-height: 1.6;
  box-shadow: 0 14px 30px -16px rgba(0, 0, 0, .6); animation: toastIn .3s var(--ease);
}
.toast .icon { margin-top: 2px; }
.toast.ok .icon { color: #7ee2b8; }
.toast.err .icon { color: #ff9d9d; }
.toast.info .icon { color: #9fd4ff; }

/* ------------------------------------------------------------ 动画 */
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-5px) rotate(1deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes slideDown { from { opacity: 0; height: 0; } to { opacity: 1; } }

/* 打印机状态驱动的吉祥物动作 */
.mascot[data-state="printing"] { animation: bob 1s ease-in-out infinite; }
.mascot[data-state="printing"] .zzz,
.mascot[data-state="idle"] .zzz,
.mascot[data-state="error"] .zzz { display: none; }
.mascot[data-state="offline"] .face { opacity: 0; }
.mascot[data-state="offline"] .face-sleep { opacity: 1 !important; }
.mascot[data-state="offline"] .zzz { display: block; opacity: .9 !important; animation: float 3s ease-in-out infinite; }
.mascot .face, .mascot .face-sleep { transition: opacity .3s; }

/* ------------------------------------------------------------ 响应式 */
@media (max-width: 1000px) {
  .hero, .split { grid-template-columns: 1fr; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .status-card { grid-template-columns: 150px 1fr; }
  .mascot { width: 146px; height: 146px; }
}

@media (max-width: 720px) {
  :root { --topbar-h: 62px; }
  body { padding-bottom: 92px; }
  .brand-sub { display: none; }
  .brand h1 { font-size: 16.5px; }
  .brand-mark { width: 38px; height: 38px; border-radius: 13px; }

  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 50;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: var(--nav-bg, rgba(255, 255, 255, .92));
    backdrop-filter: blur(18px); border-top: 1px solid var(--border);
    justify-content: space-between; gap: 0; isolation: isolate;
  }
  .tab { flex: 1; flex-direction: column; gap: 3px; padding: 7px 2px; font-size: 10.5px; border-radius: 14px; }
  .tab.active { box-shadow: none; background: var(--surface-2); }
  .tab .icon { width: 20px; height: 20px; }

  .status-card { grid-template-columns: 1fr; text-align: center; gap: 8px; }
  .status-visual { margin-top: -6px; }
  .status-copy h2 { font-size: 23px; }
  .meta-row, .status-actions { justify-content: center; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .theme-cards { grid-template-columns: 1fr; }
  .jobbar { position: fixed; top: auto; bottom: calc(64px + env(safe-area-inset-bottom)); left: 8px; right: 8px; border-radius: 14px; }
  .jobbar-inner { flex-wrap: wrap; }
  .job-item { grid-template-columns: 32px 1fr; }
  .job-right { grid-column: 2; justify-content: flex-start; }
  .preview-paper { max-width: 300px; }
  .toast-wrap { bottom: calc(84px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
