:root {
  --brand: #2563eb;
  --brand-soft: #eef4ff;
  --ink: #101828;
  --ink-2: #475467;
  --line: #e4e7ec;
  --radius: 18px;
  --pico-font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --pico-primary: var(--brand);
  --pico-primary-background: var(--brand);
  --pico-primary-hover-background: #1d4ed8;
  --pico-border-radius: 12px;
}

body {
  background: #f6f7f9;
  color: var(--ink);
  padding-bottom: 28px;
  -webkit-tap-highlight-color: transparent;
}

.container { max-width: 720px; padding: 18px 16px 0; }

.topbar {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin: 4px 0 16px;
}
.topbar h1 { font-size: 26px; margin: 0; letter-spacing: -0.4px; }
.topbar p { margin: 2px 0 0; font-size: 13px; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px -18px rgba(16, 24, 40, .28);
}

.muted { color: #667085; }
.tiny { font-size: 12.5px; line-height: 1.5; margin: 6px 0 0; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; padding: 6px 11px;
  border-radius: 999px; white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-ok { color: #027a48; background: #ecfdf3; }
.badge-wait { color: #b54708; background: #fffaeb; }
.badge-err { color: #b42318; background: #fef3f2; }

.row { display: flex; gap: 10px; }
.stat {
  flex: 1; background: #f9fafb; border: 1px solid var(--line);
  border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px;
}
.stat-label { font-size: 12px; color: #667085; }
.stat strong { font-size: 19px; font-weight: 650; letter-spacing: -0.2px; }

.addr {
  display: flex; align-items: baseline; gap: 8px; margin-top: 10px;
  font-size: 13px; flex-wrap: wrap;
}
.addr code {
  background: var(--brand-soft); color: #1d4ed8; border-radius: 8px;
  padding: 3px 8px; font-size: 12.5px; word-break: break-all;
}

.queue { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; font-size: 13px; color: var(--ink-2); }

.picker {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 2px dashed #d0d5dd; border-radius: 16px; padding: 26px 14px;
  background: #fcfcfd; color: var(--ink-2); cursor: pointer; transition: .16s;
  text-align: center; margin: 0;
}
.picker:hover, .picker.drag { border-color: var(--brand); background: var(--brand-soft); }
.picker-icon {
  width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-size: 22px; margin-bottom: 4px;
}
.picker { position: relative; }
.picker input[type="file"] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; margin: 0; padding: 0; border: 0;
}
.picker strong { font-size: 15px; color: var(--ink); }
.picker small { color: #98a2b3; }

.preview-head { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 8px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.thumb {
  position: relative; border: 2px solid var(--line); border-radius: 10px; overflow: hidden;
  background: #f2f4f7; aspect-ratio: 3 / 4; display: grid; place-items: center; cursor: pointer;
}
.thumb canvas, .thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumb.sel { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }
.thumb span {
  position: absolute; bottom: 3px; right: 4px; font-size: 10.5px;
  background: rgba(16, 24, 40, .62); color: #fff; border-radius: 5px; padding: 1px 4px;
}
.thumb.file { aspect-ratio: 4 / 3; }
.thumb.file b { font-size: 11px; padding: 6px; text-align: center; color: var(--ink-2); word-break: break-all; }

.settings { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.settings summary { font-weight: 600; cursor: pointer; color: var(--ink); font-size: 14.5px; }
.settings label { font-size: 13px; color: var(--ink-2); }
.settings input, .settings select { margin-bottom: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.actions { display: flex; gap: 10px; margin-top: 14px; }
.actions button { margin: 0; flex: 1; padding: 14px; border-radius: 13px; font-size: 16px; font-weight: 600; }
button.secondary { background: #fff; color: var(--brand); border: 1.5px solid var(--brand); }
button.link {
  background: none; border: 0; color: var(--brand); font-size: 13px; padding: 4px 2px;
  width: auto; margin: 0; cursor: pointer; font-weight: 600;
}

.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.card-head h2 { font-size: 16px; margin: 0; letter-spacing: -0.2px; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.list li {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 13px; padding: 10px 12px; background: #fff;
}
.list li.empty { border: 0; color: #98a2b3; font-size: 13px; padding: 4px 0; background: none; }
.item-main { flex: 1; min-width: 0; }
.item-name { font-size: 14px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-meta { font-size: 12px; color: #667085; margin-top: 2px; }
.state { font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.state.queued { color: #b54708; background: #fffaeb; }
.state.printing { color: #175cd3; background: #eff8ff; }
.state.done { color: #027a48; background: #ecfdf3; }
.state.error, .state.canceled { color: #b42318; background: #fef3f2; }
.item-actions { display: flex; gap: 6px; }
.item-actions button { font-size: 12px; padding: 5px 9px; border-radius: 8px; width: auto; margin: 0; }

.qr-card { text-align: center; }
.qr-card img { margin: 4px auto 0; display: block; border-radius: 12px; background: #fff; }

footer { text-align: center; padding: 6px 0 20px; }
footer a { color: var(--brand); }

@media (prefers-color-scheme: dark) {
  body { background: #0b0f16; color: #e6e9ef; }
  .card, .list li { background: #131924; border-color: #1f2733; }
  .stat { background: #0f151f; border-color: #1f2733; }
  .picker { background: #0f151f; border-color: #263041; }
  .thumb { background: #0f151f; border-color: #263041; }
  .muted, .topbar p, .item-meta, .tiny { color: #98a2b3; }
  .addr code { background: #16233a; color: #93b4ff; }
  .item-name { color: #e6e9ef; }
  .settings summary { color: #e6e9ef; }
}
