:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --line: #e7e9ee;
  --line-strong: #d8dbe2;
  --text: #16181d;
  --muted: #737a87;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eef4ff;
  --green: #15803d;
  --green-soft: #eaf7ef;
  --amber: #b45309;
  --amber-soft: #fdf4e6;
  --red: #b91c1c;
  --red-soft: #fdeceb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---------------- 登录 ---------------- */

.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 20% 15%, #eef4ff 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, #f0f7f4 0%, transparent 45%), var(--bg);
}

.login-card {
  width: 100%;
  max-width: 340px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px 26px 24px;
  box-shadow: 0 12px 40px rgba(16, 24, 40, 0.07);
  text-align: center;
}

.login-logo {
  width: 50px;
  height: 50px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card h1 { font-size: 20px; margin: 0 0 6px; letter-spacing: 0.2px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 0 0 20px; }

.login-card input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: #fff;
  color: var(--text);
}

.login-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.login-card .btn { margin-top: 12px; }

.login-error {
  color: var(--red);
  font-size: 12.5px;
  min-height: 18px;
  margin-top: 10px;
}

/* ---------------- 布局 ---------------- */

.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 58px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.brand-title { font-size: 15px; font-weight: 650; letter-spacing: 0.2px; }
.brand-sub { font-size: 11.5px; color: var(--muted); margin-top: -2px; }

.topbar-right { display: flex; align-items: center; gap: 8px; }

.printer-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  background: #f4f5f7;
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
  max-width: 240px;
}

.printer-chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b9bec7;
  flex: none;
}

.printer-chip .dot.on { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16); }
.printer-chip .dot.off { background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14); }

.printer-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.icon-btn:hover { color: var(--text); border-color: var(--line-strong); background: #fafbfc; }
.icon-btn:active { transform: scale(0.96); }

.layout {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 18px 8px;
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  flex: 1;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 14px 12px 8px; gap: 12px; }
  .brand-sub { display: none; }
  .printer-chip { max-width: 130px; }
}

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

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.card-head h2 { font-size: 14px; font-weight: 650; margin: 0; letter-spacing: 0.2px; }
.hint { font-size: 11.5px; color: var(--muted); }

/* ---------------- 上传区 ---------------- */

.drop {
  border: 1.5px dashed var(--line-strong);
  border-radius: 12px;
  padding: 22px 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.16s;
  background: #fcfcfd;
}

.drop:hover { border-color: #b9c6e6; background: #fbfcff; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }

.drop-icon { color: #9aa4b2; margin-bottom: 6px; }
.drop.over .drop-icon { color: var(--accent); }
.drop-title { font-size: 13px; font-weight: 550; }
.drop-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

.file-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbfc;
}

.file-ext {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 6px;
  border-radius: 5px;
  flex: none;
}

.file-name {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size { font-size: 11.5px; color: var(--muted); flex: none; }

.chip-x {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  flex: none;
}

.chip-x:hover { color: var(--red); }

.options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.field { display: flex; flex-direction: column; gap: 5px; }
.field-wide { grid-column: 1 / -1; }
.field span { font-size: 11.5px; color: var(--muted); }

.field select,
.field input {
  width: 100%;
  height: 36px;
  padding: 0 9px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field select:focus,
.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.check {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 12px 0;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
}

.check input { width: 15px; height: 15px; accent-color: var(--accent); }

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0;
}

.row-between .check { margin: 0; }

.link-btn {
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  padding: 4px 2px;
  white-space: nowrap;
}

.link-btn:hover { text-decoration: underline; }
.link-btn:disabled { color: #9aa4b2; cursor: default; text-decoration: none; }

.btn {
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 550;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-block { width: 100%; }

.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(37, 99, 235, 0.3); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { background: #c7d2fe; color: #fff; cursor: not-allowed; box-shadow: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }

.progress {
  height: 3px;
  background: var(--accent-soft);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 10px;
}

.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }

/* ---------------- 队列 ---------------- */

.jobs { display: flex; flex-direction: column; gap: 2px; max-height: 62vh; overflow-y: auto; }

.job {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 8px;
  border-radius: 10px;
  transition: background 0.12s;
}

.job:hover { background: #fafbfc; }
.job + .job { border-top: 1px solid #f1f2f5; }

.job-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #f4f5f7;
  color: #6b7280;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  text-transform: uppercase;
}

.job-icon.pdf { background: var(--red-soft); color: var(--red); }
.job-icon.image { background: #eef7f2; color: #0f766e; }
.job-icon.office { background: var(--accent-soft); color: var(--accent); }

.job-main { flex: 1; min-width: 0; }

.job-name {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.job-err { font-size: 11.5px; color: var(--red); margin-top: 3px; word-break: break-all; }
.job-warn {
  font-size: 11.5px;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 4px 7px;
  margin-top: 4px;
  line-height: 1.4;
}

.job-side { display: flex; align-items: center; gap: 6px; flex: none; }

.pill {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 99px;
  font-weight: 550;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.pill::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.pill.done { background: var(--green-soft); color: var(--green); }
.pill.failed { background: var(--red-soft); color: var(--red); }
.pill.queued, .pill.converting, .pill.waiting, .pill.printing { background: var(--amber-soft); color: var(--amber); }
.pill.ready { background: #eaf5fd; color: #0369a1; }
.pill.canceled { background: #f4f5f7; color: #6b7280; }

.pill.queued::before, .pill.converting::before, .pill.waiting::before, .pill.printing::before {
  animation: pulse 1.1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.job-act {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  height: 26px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 11.5px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.13s;
  white-space: nowrap;
}

.job-act:hover { color: var(--text); border-color: var(--line-strong); background: #fafbfc; }
.job-act.primary { color: var(--accent); border-color: #cddcfb; background: var(--accent-soft); }
.job-act.danger:hover { color: var(--red); border-color: #f5cfcd; background: var(--red-soft); }

.empty { text-align: center; color: var(--muted); font-size: 13px; padding: 46px 10px; }
.empty-icon { color: #c9ced8; margin-bottom: 8px; }
.empty-sub { font-size: 11.5px; margin-top: 4px; color: #9aa4b2; }

.footer {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 4px 18px 18px;
  font-size: 11px;
  color: #9aa4b2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.url-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  max-width: 100%;
}
.url-chip:hover { border-color: var(--accent); color: var(--accent); }
.url-chip.hidden { display: none; }
.url-chip svg { flex: none; }
.url-chip #publicUrlText { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.url-copy {
  color: var(--muted);
  font-size: 10.5px;
  border-left: 1px solid var(--line);
  padding-left: 7px;
  flex: none;
}

/* ---------------- Toast ---------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 14px);
  background: #1f2328;
  color: #fff;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: all 0.22s;
  max-width: 88vw;
  z-index: 100;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #991b1b; }

/* ---------------- 修改密码弹窗 ---------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(20, 24, 32, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 340px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 20px 18px;
  box-shadow: 0 18px 50px rgba(16, 24, 40, 0.2);
}

.modal-card h3 { font-size: 15px; margin: 0 0 4px; }
.modal-sub { font-size: 11.5px; color: var(--muted); margin: 0 0 16px; }
.modal-card .field { margin-bottom: 12px; }
.modal-card .field input { height: 38px; }

.modal-error { font-size: 12px; color: var(--red); min-height: 17px; }

.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.modal-actions .btn { height: 36px; }

.btn-ghost {
  background: #fff;
  color: var(--muted);
  border-color: var(--line-strong);
}

.btn-ghost:hover { color: var(--text); background: #fafbfc; }

/* ---------------- 上传状态 / 打印预览 ---------------- */

.upload-note {
  font-size: 11.5px;
  color: var(--muted);
  min-height: 16px;
  margin-top: 8px;
  text-align: center;
}

.preview-card {
  max-width: 880px;
  width: 100%;
  height: min(88vh, 860px);
  padding: 0;
  display: flex;
  flex-direction: column;
}

.preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 10px;
}

.preview-heading { min-width: 0; }
.preview-heading h3 {
  font-size: 15px;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 620px;
}
.preview-head .modal-sub { margin: 3px 0 0; }
.preview-head .chip-x { font-size: 22px; }

.preview-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0 20px;
}

.preview-body iframe {
  flex: 1;
  min-height: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f4f5f7;
}

.preview-fallback {
  font-size: 11.5px;
  color: var(--muted);
  padding: 7px 2px 0;
  text-align: right;
}

.preview-fallback a { color: var(--accent); text-decoration: none; }
.preview-fallback a:hover { text-decoration: underline; }

.preview-opts {
  font-size: 12px;
  color: var(--muted);
  padding: 10px 20px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-card .modal-actions { padding: 12px 20px 18px; flex: none; }

@media (max-width: 640px) {
  .preview-card { height: 94vh; border-radius: 12px; }
  .preview-head { padding: 14px 14px 8px; }
  .preview-body { padding: 0 12px; }
  .preview-opts { padding: 10px 14px 0; }
  .preview-card .modal-actions { padding: 12px 14px 16px; }
  .preview-heading h3 { max-width: 240px; }
}

@media (max-width: 560px) {
  .jobs { max-height: none; }
  .job-meta { font-size: 11px; }
  .job-side .pill { display: none; }
  .card { padding: 14px; }
}
