:root {
  --bg: #f4f1ec;
  --panel: #ffffff;
  --ink: #1a1917;
  --muted: #6b6560;
  --line: #e2dcd4;
  --accent: #1f6feb;
  --accent-soft: #e8f0fe;
  --ok: #1f7a4c;
  --warn: #b8860b;
  --bad: #c0392b;
  --radius: 12px;
  --shadow: 0 8px 28px rgba(26, 25, 23, 0.06);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body { line-height: 1.5; }

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark { width: 36px; height: 36px; flex: 0 0 auto; }
.brand h1 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: 0.02em; }
.tag { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--panel);
}

.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
}

.status-pill[data-state="ok"]::before { background: var(--ok); }
.status-pill[data-state="ok"] { color: var(--ok); border-color: #cfe5d8; background: #f2faf5; }
.status-pill[data-state="bad"]::before { background: var(--bad); }
.status-pill[data-state="bad"] { color: var(--bad); border-color: #f0d2cf; background: #fdf4f3; }
.status-pill[data-state="wait"]::before { background: var(--warn); }

.grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .status-row { justify-content: flex-start; }
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.card-head { margin-bottom: 16px; }
.card-head.row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.card-head h2 { margin: 0; font-size: 18px; font-weight: 650; }
.card-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.dropzone {
  position: relative;
  border: 1.5px dashed #cfc6ba;
  border-radius: 10px;
  background:
    linear-gradient(180deg, #fff 0%, #fbfaf8 100%);
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.dropzone::before,
.dropzone::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid var(--accent);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.dropzone::before {
  top: 8px; left: 8px;
  border-right: 0; border-bottom: 0;
}
.dropzone::after {
  right: 8px; bottom: 8px;
  border-left: 0; border-top: 0;
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--accent);
  outline: none;
}
.dropzone:hover::before,
.dropzone:hover::after,
.dropzone:focus-visible::before,
.dropzone:focus-visible::after,
.dropzone.dragover::before,
.dropzone.dragover::after { opacity: 1; }

.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.01);
}

.paper-icon { width: 48px; height: 60px; }
.drop-title { margin: 4px 0 0; font-weight: 600; }
.drop-hint { margin: 0; color: var(--muted); font-size: 12px; }

.file-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfbf9;
  font-size: 13px;
}

.file-list .meta { color: var(--muted); white-space: nowrap; }
.file-list button {
  border: 0;
  background: transparent;
  color: var(--bad);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.options {
  display: grid;
  grid-template-columns: 90px 140px 1fr auto;
  gap: 12px;
  align-items: end;
  margin-top: 16px;
}

@media (max-width: 700px) {
  .options { grid-template-columns: 1fr 1fr; }
  .options .grow { grid-column: 1 / -1; }
  .options .btn { grid-column: 1 / -1; }
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

label.grow { min-width: 0; }

input[type="number"],
input[type="text"],
input[type="password"],
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  background: #fff;
  color: var(--ink);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost:hover { background: #f7f4ef; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.queue {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
}

.empty {
  color: var(--muted);
  font-size: 13px;
  padding: 28px 12px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.job {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fcfbf9;
  animation: rise 0.28s ease;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.job-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.job-name {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  word-break: break-all;
}

.job-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}

.job-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.job-actions button {
  font-size: 12px;
  padding: 6px 10px;
}

.badge {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.badge.queued { color: var(--warn); border-color: #eadfb0; background: #fbf7ea; }
.badge.printing { color: var(--accent); border-color: #c9dafc; background: var(--accent-soft); }
.badge.done { color: var(--ok); border-color: #cfe5d8; background: #f2faf5; }
.badge.failed { color: var(--bad); border-color: #f0d2cf; background: #fdf4f3; }
.badge.canceled { color: var(--muted); }

.help-card { margin-top: 20px; }
.help-card h2 { margin: 0 0 10px; font-size: 16px; }
.steps { margin: 0; padding-left: 18px; color: var(--ink); font-size: 14px; }
.steps li { margin-bottom: 6px; }
.steps code, .muted code {
  font-family: Consolas, "Cascadia Code", monospace;
  background: #f1eee9;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.muted { color: var(--muted); font-size: 12px; }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
}

dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  width: min(420px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}

dialog::backdrop { background: rgba(26, 25, 23, 0.28); }

.settings-form {
  padding: 20px;
  display: grid;
  gap: 12px;
}

.settings-form h2 { margin: 0; font-size: 18px; }
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 20;
  box-shadow: var(--shadow);
}
