:root {
  --bg: #F5F3EE;
  --card: #FFFFFF;
  --ink: #1B1B18;
  --ink-2: #4A4740;
  --muted: #7A756C;
  --line: #E5E0D7;
  --line-soft: #EFEBE3;
  --brand: #1C5E52;
  --brand-dark: #144A40;
  --brand-soft: #E9F1EE;
  --warn: #B8693F;
  --danger: #B23A2E;
  --ok: #2E7D5B;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(30, 26, 20, .04), 0 8px 24px -12px rgba(30, 26, 20, .12);
}

* { box-sizing: border-box; }

/* hidden 必须压过下面所有 display 设定，否则弹层/视图会同时出现 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(720px 420px at 12% -8%, rgba(28, 94, 82, .07), transparent 60%),
    radial-gradient(620px 380px at 96% 4%, rgba(184, 105, 63, .06), transparent 62%);
  z-index: 0;
}

button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }

/* ---------- 登录 ---------- */
.login-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 32px 28px 24px;
  box-shadow: var(--shadow);
}

.brand-mark {
  font-size: 11px;
  letter-spacing: .18em;
  color: var(--brand);
  font-weight: 600;
  margin-bottom: 14px;
}

.login-card h1 { font-size: 26px; margin-bottom: 6px; }
.login-card .sub { color: var(--muted); font-size: 13.5px; margin: 0 0 24px; }

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block;
  font-size: 12.5px;
  color: var(--ink-2);
  font-weight: 500;
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #FCFBF9;
  font-size: 15px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.field input:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(28, 94, 82, .1);
}

.btn {
  height: 44px;
  padding: 0 20px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 500;
  transition: background .15s, border-color .15s, transform .06s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.primary:disabled { background: #B9C7C3; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn.ghost:hover { background: #F7F5F1; }

.err {
  color: var(--danger);
  font-size: 13px;
  margin: 10px 0 0;
}
.foot {
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  margin: 18px 0 0;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(245, 243, 238, .88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  max-width: 880px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #B9B4A9;
  flex: 0 0 auto;
  box-shadow: 0 0 0 3px rgba(185, 180, 169, .18);
}
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(46, 125, 91, .16); }
.dot.bad { background: var(--danger); box-shadow: 0 0 0 3px rgba(178, 58, 46, .16); }
.brand-name { font-size: 15px; font-weight: 600; line-height: 1.2; }
.brand-sub {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 42vw;
}
.top-right { display: flex; align-items: center; gap: 4px; }
.who {
  font-size: 13px;
  color: var(--ink-2);
  margin-right: 6px;
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: none; background: transparent;
  color: var(--muted);
  border-radius: 8px;
}
.icon-btn:hover { background: rgba(0,0,0,.05); color: var(--ink); }
.text-btn {
  border: none; background: transparent;
  color: var(--muted); font-size: 13px;
  padding: 6px 8px; border-radius: 8px;
}
.text-btn:hover { color: var(--ink); background: rgba(0,0,0,.04); }
.text-btn.muted { font-size: 12.5px; }

/* ---------- 主体 ---------- */
.wrap {
  position: relative;
  z-index: 1;
  max-width: 880px;
  margin: 0 auto;
  padding: 20px 20px 48px;
}

.dropzone {
  background: var(--card);
  border: 1.5px dashed #D6D0C4;
  border-radius: var(--radius);
  padding: 30px 20px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .16s, background .16s, color .16s;
}
.dropzone:hover, .dropzone.hot {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}
.dz-icon { color: currentColor; opacity: .75; margin-bottom: 8px; }
.dz-main { font-size: 15px; font-weight: 500; color: var(--ink); }
.dropzone.hot .dz-main, .dropzone:hover .dz-main { color: var(--brand); }
.dz-sub { font-size: 12.5px; margin-top: 4px; color: var(--muted); }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-top: 16px;
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-head h2 { font-size: 14.5px; }
.count {
  display: inline-block;
  min-width: 20px;
  height: 20px;
  line-height: 20px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
  vertical-align: 1px;
  margin-left: 4px;
}
.live {
  font-size: 11.5px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.live i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok);
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe { 0%,100% { opacity: .35 } 50% { opacity: 1 } }

.list { padding: 4px 0; }

.empty {
  padding: 34px 18px;
  text-align: center;
  color: #A8A299;
  font-size: 13.5px;
}

/* ---------- 待打印行 ---------- */
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.row:last-child { border-bottom: none; }

.fbadge {
  width: 38px; height: 44px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .04em;
  flex: 0 0 auto;
  border: 1px solid;
}
.fb-pdf { background: #FBEDEA; color: #A93B2C; border-color: #F2D8D2; }
.fb-word { background: #EAF0F7; color: #2C5C8F; border-color: #D6E2EF; }
.fb-excel { background: #EAF4EC; color: #2C7048; border-color: #D5E8DA; }
.fb-ppt { background: #FBEFE6; color: #A95E24; border-color: #F2DFCF; }
.fb-image { background: #F1EEF7; color: #5B4A85; border-color: #E2DCF0; }

.row-main { flex: 1 1 auto; min-width: 0; }
.row-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.row-err { font-size: 12px; color: var(--danger); margin-top: 3px; }

.row-tools { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  height: 30px;
}
.stepper button {
  width: 26px; height: 100%;
  border: none; background: #FAF9F6;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1;
  display: grid; place-items: center;
}
.stepper button:hover { background: #F0EDE6; }
.stepper input {
  width: 30px; height: 100%;
  border: none; border-left: 1px solid var(--line); border-right: 1px solid var(--line);
  text-align: center;
  font-size: 13px;
  background: #fff;
  outline: none;
  -moz-appearance: textfield;
  padding: 0;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.chip-toggle {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #FAF9F6;
  border-radius: 8px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.chip-toggle.on {
  background: var(--brand-soft);
  border-color: #BFD6CE;
  color: var(--brand);
  font-weight: 500;
}

.del-btn {
  width: 30px; height: 30px;
  border: none; background: transparent;
  border-radius: 8px;
  color: #B3ADA3;
  display: grid; place-items: center;
}
.del-btn:hover { background: #FBEDEA; color: var(--danger); }

.tray-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-top: 1px solid var(--line-soft);
  background: #FCFBF8;
}
.summary { font-size: 12.5px; color: var(--muted); }
.summary b { color: var(--ink); font-weight: 600; }

/* ---------- 任务状态 ---------- */
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 500;
  white-space: nowrap;
  flex: 0 0 auto;
}
.status i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.s-queued { background: #F1EFEA; color: #7A756C; }
.s-converting { background: #EAF0F7; color: #2C5C8F; }
.s-printing { background: #FBEFE6; color: #A95E24; }
.s-printing i { animation: breathe 1.2s ease-in-out infinite; }
.s-done { background: #E9F3ED; color: var(--ok); }
.s-failed { background: #FBEDEA; color: var(--danger); }
.s-canceled { background: #F1EFEA; color: #9A948A; }

.retry-btn {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  font-size: 12px;
  color: var(--ink-2);
}
.retry-btn:hover { border-color: var(--brand); color: var(--brand); }

.bottom-note {
  text-align: center;
  font-size: 11.5px;
  color: #A8A299;
  margin: 22px 0 0;
}

/* ---------- 弹层 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(28, 24, 18, .38);
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-card {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 24px 60px -20px rgba(0,0,0,.35);
}
.modal-card h3 { font-size: 17px; margin-bottom: 16px; }
.field-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--muted);
}
.field-row strong { color: var(--ink); font-weight: 500; font-size: 13px; text-align: right; }
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}
.modal-actions .btn { height: 40px; font-size: 14px; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 90;
  background: #26221B;
  color: #fff;
  font-size: 13.5px;
  padding: 11px 18px;
  border-radius: 10px;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.4);
  max-width: calc(100vw - 40px);
}
.toast.bad { background: #8E2E24; }

/* ---------- 移动端 ---------- */
@media (max-width: 620px) {
  body { font-size: 14.5px; }
  .wrap { padding: 14px 14px 40px; }
  .topbar-in { padding: 10px 14px; }
  .brand-sub { max-width: 38vw; }
  .dropzone { padding: 24px 16px; }
  .row { padding: 12px 14px; gap: 10px; flex-wrap: wrap; }
  .row-main { flex: 1 1 100%; order: 1; padding-left: 50px; margin-top: -38px; margin-bottom: 6px; }
  .row-tools { order: 2; margin-left: 50px; }
  .row-tools { flex-wrap: wrap; }
  .tray-foot { flex-direction: column; align-items: stretch; gap: 10px; }
  .tray-foot .btn { width: 100%; }
  .who { display: none; }
  .stepper button { width: 30px; }
  .panel-head { padding: 13px 14px; }
}
