/* AHL 打印站 — Apple 设计语言 + CJK 适配（依据项目根 DESIGN.md） */
:root {
  --primary: #0066cc;
  --primary-focus: #0071e3;
  --ink: #1d1d1f;
  --ink-muted: #7a7a7a;
  --hairline: #e0e0e0;
  --divider-soft: #f0f0f0;
  --canvas: #ffffff;
  --parchment: #f5f5f7;
  --pearl: #fafafc;
  --error: #ff3b30; /* 语义状态色，非交互强调色 */
  --ok: #34c759;    /* 语义状态色 */
  --radius-lg: 18px;
  --radius-sm: 8px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { background: var(--parchment); }
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 17px; font-weight: 400; line-height: 1.7; /* CJK 行高 */
  color: var(--ink);
  padding-bottom: 96px; /* 给 sticky bar 留位 */
}
button { font-family: inherit; cursor: pointer; }

/* 顶栏 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: var(--canvas);
  border-bottom: 1px solid var(--divider-soft);
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; }
.printer-chip {
  display: flex; align-items: center; gap: 7px;
  background: var(--pearl); border: 1px solid var(--hairline);
  border-radius: 9999px; padding: 4px 12px; font-size: 12px; color: var(--ink-muted);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-muted); flex: none; }
.dot.online { background: var(--ok); }
.dot.offline { background: var(--error); }
.dot.busy { background: var(--primary-focus); }

/* 分段标签 */
.seg {
  display: flex; gap: 4px; background: var(--parchment);
  padding: 8px 16px 0; max-width: 760px; margin: 0 auto; width: 100%;
}
.seg-btn {
  flex: 1; border: none; background: transparent; color: var(--ink-muted);
  font-size: 14px; padding: 9px 0; border-radius: 9999px; position: relative;
}
.seg-btn.active { background: var(--canvas); color: var(--ink); font-weight: 600; box-shadow: inset 0 0 0 1px var(--hairline); }
.seg-badge {
  position: absolute; top: 2px; right: 10px; background: var(--primary);
  color: #fff; font-size: 10px; line-height: 1; padding: 3px 6px; border-radius: 9999px;
}

main { max-width: 760px; margin: 0 auto; padding: 16px; }

/* 上传区 */
.dropzone {
  background: var(--canvas); border: 1px dashed var(--hairline);
  border-radius: var(--radius-lg); padding: 36px 20px; text-align: center;
  cursor: pointer; transition: border-color .15s;
}
.dropzone.drag { border-color: var(--primary-focus); }
.dropzone-title { font-size: 17px; font-weight: 600; color: var(--primary); letter-spacing: -0.01em; }
.dropzone-caption { font-size: 14px; color: var(--ink-muted); margin-top: 4px; line-height: 1.43; }

.progress { height: 6px; background: var(--divider-soft); border-radius: 9999px; margin-top: 12px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--primary); border-radius: 9999px; transition: width .2s; }
.progress-caption { font-size: 12px; color: var(--ink-muted); margin-top: 6px; }

/* 照片网格 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 16px; }
.ph {
  position: relative; background: var(--canvas); border: 1px solid var(--hairline);
  border-radius: var(--radius-lg); overflow: hidden; cursor: pointer;
}
.ph.sel { box-shadow: inset 0 0 0 2px var(--primary-focus); }
.ph img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.ph .pick {
  position: absolute; left: 8px; top: 8px; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(210, 210, 215, .72); color: transparent; font-size: 15px; line-height: 26px;
  text-align: center; font-weight: 600;
}
.ph.sel .pick { background: var(--primary); color: #fff; }
.ph .rm {
  position: absolute; right: 6px; top: 6px; width: 26px; height: 26px; border-radius: 50%;
  border: none; background: rgba(210, 210, 215, .72); color: var(--ink); font-size: 14px; line-height: 1;
}
.ph .name {
  font-size: 12px; color: var(--ink-muted); padding: 6px 10px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; line-height: 1.3;
}
.doc-badge {
  position: absolute; left: 8px; bottom: 34px;
  background: rgba(29, 29, 31, .78); color: #fff;
  font-size: 10px; font-weight: 600; letter-spacing: .02em;
  padding: 2px 7px; border-radius: 6px;
}
.doc-hint {
  font-size: 12px; color: var(--primary); margin-top: 8px;
  padding-top: 10px; border-top: 1px solid var(--divider-soft); line-height: 1.5;
}

/* 卡片与设定 */
.card {
  background: var(--canvas); border: 1px solid var(--hairline);
  border-radius: var(--radius-lg); padding: 20px; margin-top: 16px;
}
.settings .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 8px 0; }
.row-label { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--hairline); background: var(--canvas); color: var(--ink);
  border-radius: 9999px; padding: 7px 16px; font-size: 14px;
}
.chip.selected { border: 2px solid var(--primary-focus); padding: 6px 15px; font-weight: 600; }
.chip:active { transform: scale(0.95); }
.stepper { display: flex; align-items: center; gap: 2px; border: 1px solid var(--hairline); border-radius: 9999px; }
.step-btn { border: none; background: transparent; font-size: 20px; width: 44px; height: 40px; color: var(--primary); }
.step-num { min-width: 34px; text-align: center; font-weight: 600; }
.paper-line { font-size: 12px; color: var(--ink-muted); border-top: 1px solid var(--divider-soft); margin-top: 10px; padding-top: 10px; }

/* 底部动作条 */
.sticky-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(245, 245, 247, .85); backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--divider-soft);
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
}
.sticky-left { font-size: 14px; color: var(--ink-muted); }
.btn-primary {
  background: var(--primary); color: #fff; border: none; border-radius: 9999px;
  font-size: 17px; padding: 11px 26px; min-height: 44px;
}
.btn-primary:active { transform: scale(0.95); }
.btn-primary:disabled { background: var(--hairline); color: var(--ink-muted); }
.btn-secondary {
  background: transparent; color: var(--primary); border: 1px solid var(--primary);
  border-radius: 9999px; font-size: 14px; padding: 6px 16px;
}
.btn-secondary:active { transform: scale(0.95); }
.btn-danger-text { background: transparent; border: none; color: var(--error); font-size: 14px; padding: 6px 10px; }

/* 队列/历史 */
.banner {
  border-radius: var(--radius-lg); padding: 14px 18px; font-size: 14px; margin-bottom: 12px;
  background: var(--canvas); border: 1px solid var(--hairline); line-height: 1.5;
}
.banner.warn { border-color: var(--primary-focus); }
.banner.err { border-color: var(--error); }

/* 墨量条 */
.inks {
  display: flex; gap: 14px; background: var(--canvas);
  border: 1px solid var(--hairline); border-radius: var(--radius-lg);
  padding: 12px 18px; margin-bottom: 12px;
}
.inks[hidden] { display: none; }
.ink { flex: 1; min-width: 0; }
.ink-bar { height: 8px; background: var(--divider-soft); border-radius: 9999px; overflow: hidden; }
.ink-fill { height: 100%; border-radius: 9999px; }
.ink-label { font-size: 11px; color: var(--ink-muted); margin-top: 4px; text-align: center; }
.job {
  display: flex; align-items: center; gap: 14px;
  background: var(--canvas); border: 1px solid var(--hairline);
  border-radius: var(--radius-lg); padding: 12px 14px; margin-bottom: 10px;
}
.job img { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius-sm); flex: none; background: var(--parchment); }
.job img.img-missing { visibility: hidden; }
.job-main { flex: 1; min-width: 0; }
.job-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-status { font-size: 12px; color: var(--ink-muted); line-height: 1.4; }
.job-actions { display: flex; flex-direction: column; gap: 6px; flex: none; }
.badge {
  display: inline-block; font-size: 12px; padding: 2px 10px; border-radius: 9999px;
  background: var(--parchment); color: var(--ink-muted); margin-right: 6px;
}
.badge.printing { background: var(--primary); color: #fff; }
.badge.done { background: var(--parchment); color: var(--ink); }
.badge.failed { background: rgba(255, 59, 48, .12); color: var(--error); }
.empty { text-align: center; color: var(--ink-muted); font-size: 14px; padding: 48px 0; }

/* 访问码 */
.overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.overlay[hidden] { display: none; }
.auth-card { background: var(--canvas); border-radius: var(--radius-lg); padding: 28px 24px; width: 100%; max-width: 340px; }
.auth-title { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 12px; }
.auth-input {
  width: 100%; font-size: 17px; padding: 11px 16px; border: 1px solid var(--hairline);
  border-radius: 9999px; outline: none; font-family: inherit;
}
.auth-input:focus { border-color: var(--primary-focus); }
.auth-error { color: var(--error); font-size: 14px; margin-top: 8px; }
.auth-btn { width: 100%; margin-top: 16px; }

/* 提示 */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 110px; z-index: 60;
  background: var(--ink); color: #fff; font-size: 14px; padding: 10px 20px;
  border-radius: 9999px; max-width: 86vw;
}

/* 版本页脚：由运行进程产生（/api/version） */
.app-ver {
  text-align: center; font-size: 11px; color: var(--ink-muted);
  padding: 8px 0 4px; letter-spacing: .01em;
}

/* 模板卡片 */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.tpl-card {
  background: var(--canvas); border: 1px solid var(--hairline);
  border-radius: var(--radius-lg); padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.tpl-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.tpl-desc { font-size: 13px; color: var(--ink-muted); line-height: 1.5; margin-top: -6px; }
.tpl-input {
  font-size: 15px; padding: 9px 14px; border: 1px solid var(--hairline);
  border-radius: 10px; outline: none; font-family: inherit; background: var(--pearl);
}
.tpl-input:focus { border-color: var(--primary-focus); }
.tpl-check { font-size: 13px; color: var(--ink-muted); display: flex; align-items: center; gap: 6px; }
.tpl-print { margin-top: auto; font-size: 15px; padding: 9px 0; min-height: 40px; }

/* 快捷打印指南 */
details.guide { padding: 16px 20px; }
details.guide summary { font-size: 15px; font-weight: 600; cursor: pointer; }
.guide-list { margin: 12px 0 0 20px; font-size: 14px; line-height: 1.9; }
.guide-list code, .guide-tip code {
  background: var(--parchment); padding: 1px 6px; border-radius: 6px; font-size: 13px;
}
.guide-tip { margin-top: 10px; font-size: 13px; color: var(--ink-muted); }

/* 行内链接按钮（校准页） */
.link-btn {
  border: none; background: transparent; color: var(--primary); font-size: 12px;
  font-weight: 400; padding: 0 0 0 6px; cursor: pointer;
}
.link-btn:active { opacity: .6; }

/* 扫描 */
.scan-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding-top: 10px; }
.scan-status { border-top: none; margin-top: 0; padding-top: 0; flex: 1; min-width: 160px; }
.job-actions a.btn-secondary { text-decoration: none; text-align: center; display: inline-block; }

@media (max-width: 480px) {
  .topbar-title { font-size: 19px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
  main { padding: 12px; }
}
