:root {
  color-scheme: light;
  --bg: #f6f3ed;
  --card: #fffefb;
  --ink: #1c1915;
  --muted: #6f675c;
  --line: #e4dccf;
  --accent: #0d7a5f;
  --accent-ink: #ffffff;
  --danger: #b91c1c;
  --warn: #9a5b12;
  --shadow: 0 1px 2px rgba(28, 25, 21, 0.04), 0 16px 36px -20px rgba(28, 25, 21, 0.2);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
  font-variant-numeric: tabular-nums;
  background:
    radial-gradient(720px 340px at 90% -10%, rgba(13, 122, 95, 0.11), transparent 68%),
    var(--bg);
  color: var(--ink);
}
main {
  max-width: 920px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}
h1 { font-size: 28px; margin: 0; font-weight: 650; flex: 0 0 auto; }
.header-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 0;
}
p { margin: 0; color: var(--muted); line-height: 1.5; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 14px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 2px rgba(28, 25, 21, 0.04);
}
.badge::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
}
.badge.online { color: var(--accent); }
.badge.online::before { animation: dot-pulse 2s ease-in-out infinite; }
.badge.offline { color: var(--warn); }
.grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 16px; }
.grid > section { min-width: 0; }
section {
  background: var(--card);
  border: 1px solid rgba(28, 25, 21, 0.06);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}
h2 { margin: 0 0 14px; font-size: 16px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
input, select, button { font: inherit; }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 122, 95, 0.16);
}
.check input:focus, .file-drop input:focus {
  border-color: transparent;
  box-shadow: none;
}
.row { display: flex; gap: 12px; }
.row > div { flex: 1; }
.secret { display: flex; align-items: center; gap: 8px; }
.secret input { flex: 1; min-width: 0; }
.secret button { flex: 0 0 auto; }
button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #149e7c, var(--accent));
  color: var(--accent-ink);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(13, 122, 95, 0.28);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(13, 122, 95, 0.34); }
button.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
button.secondary:hover:not(:disabled) { background: rgba(28, 25, 21, 0.03); border-color: #8f8678; box-shadow: none; }
button.danger { background: transparent; color: var(--danger); border: 1px solid #f0c4c4; box-shadow: none; }
button.danger:hover:not(:disabled) { background: #fdeeee; box-shadow: none; }
button:disabled { opacity: 0.55; cursor: default; transform: none; box-shadow: none; }
#notify { margin-top: 8px; display: none; }
#install { margin-top: 8px; }
.actions { display: flex; gap: 8px; margin-top: 16px; }
#submit {
  width: 100%;
  display: block;
  padding: 14px 18px;
  font-weight: 650;
  letter-spacing: 0.08em;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 42%),
    linear-gradient(135deg, #0f8f6e 0%, #0d7a5f 55%, #0a5c48 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 10px 24px -8px rgba(13, 122, 95, 0.5);
}
#submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 16px 32px -10px rgba(13, 122, 95, 0.6);
}
#submit:active:not(:disabled) {
  transform: translateY(1px) scale(0.985);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 4px 10px -6px rgba(13, 122, 95, 0.45);
}
.jobs-scroll {
  margin-top: 14px;
  max-height: min(70vh, 640px);
  overflow-y: auto;
  padding-right: 4px;
}
.jobs { display: flex; flex-direction: column; gap: 10px; }
.job {
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  font-size: 14px;
  background: #fff;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.job:hover { box-shadow: 0 8px 20px -14px rgba(28, 25, 21, 0.45); }
.job.QUEUED { border-left-color: #a8a29e; }
.job.DISPATCHED { border-left-color: #3b82f6; }
.job.DOWNLOADING { border-left-color: #06b6d4; }
.job.PRINTING {
  border-left-color: #f59e0b;
  background-image: linear-gradient(180deg, transparent, rgba(255, 247, 237, 0.95), transparent);
  background-size: 3px 36%;
  background-repeat: no-repeat;
  background-position: left 0 top -40%;
  animation: bar-flow 1.35s linear infinite;
}
.job.DONE { border-left-color: #22c55e; }
.job.FAILED { border-left-color: #ef4444; }
.job.CANCELED { border-left-color: #78716c; }
.job-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.file-type {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1.4;
  padding: 2px 7px;
  border-radius: 6px;
  background: #78716c;
  color: #fff;
}
.file-type.pdf { background: #dc2626; }
.file-type.image { background: #7c3aed; }
.file-type.word { background: #2563eb; }
.file-type.excel { background: #15803d; }
.job-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}
.job-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.job-meta { flex: 1; min-width: 0; }
.job-actions { flex: 0 0 auto; align-self: center; }
.job .meta { font-size: 12px; }
.job-meta .meta {
  display: flex;
  flex-wrap: wrap;
  row-gap: 2px;
}
.job-meta .meta + .meta { margin-top: 2px; }
.job-meta .meta span { white-space: nowrap; }
.job-meta .meta span:not(:last-child)::after { content: " · "; }
.job-facts { flex-wrap: nowrap; justify-content: space-between; gap: 8px; }
.job-meta .meta.job-facts span::after { content: none; }
.job-when { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.job-size { margin-left: auto; }
.job .meta.job-error { color: var(--danger); }
.job-actions button {
  font-size: 12px;
  line-height: 1.2;
  padding: 4px 10px;
  border-radius: 8px;
}
#jobsSentinel { padding: 8px 0 2px; text-align: center; }
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 0;
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}
.check input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.check .box {
  position: relative;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border: 1.5px solid #c9bfb0;
  border-radius: 6px;
  background: #fff;
}
.check:hover .box { border-color: #8f8678; }
.check input:checked + .box {
  background: var(--accent);
  border-color: var(--accent);
}
.check input:checked + .box::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.check input:focus-visible + .box {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.check:has(input:disabled) { opacity: 0.55; cursor: default; }
fieldset.pages:disabled .check { opacity: 1; }
.file-drop {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 12px;
  border: 1.5px dashed #c9bfb0;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.file-drop:hover { border-color: var(--accent); background: #f4faf7; }
.file-drop.dragover,
.file-drop:focus-within {
  border-color: var(--accent);
  background: #eef8f4;
}
.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.file-button {
  flex: 0 0 auto;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
}
.file-drop:hover .file-button,
.file-drop:focus-within .file-button,
.file-drop.dragover .file-button {
  border-color: var(--accent);
  color: var(--accent);
}
.file-summary {
  min-width: 0;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.meta { color: var(--muted); font-size: 13px; }
.state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 0 0 auto;
  min-width: 5.2em;
  text-align: center;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f4f2ee;
  color: #78716c;
}
.state::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
}
.state.QUEUED { color: #78716c; background: #f4f2ee; }
.state.DISPATCHED { color: #1d4ed8; background: #e4ebfd; }
.state.DOWNLOADING { color: #0e7490; background: #ddf1f6; }
.state.PRINTING { color: #c2410c; background: #fdeeda; }
.state.DONE { color: #15803d; background: #e2f6e9; }
.state.FAILED { color: #b91c1c; background: #fde7e7; }
.state.CANCELED { color: #57534e; background: #ebe8e4; }
.state.DISPATCHED::before,
.state.DOWNLOADING::before,
.state.PRINTING::before { animation: dot-pulse 1.6s ease-in-out infinite; }
.hint, .note { margin-top: 10px; color: var(--muted); font-size: 13px; min-height: 1.2em; }
.hint.error { color: var(--danger); }
.hint.warn { color: var(--warn); }
.hint.ok { color: var(--accent); }
.toasts {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(420px, calc(100vw - 24px));
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  animation: toast-in 0.18s ease;
}
.toast.error { color: var(--danger); border-color: #f0c8c8; background: #fff6f6; }
.toast.warn { color: var(--warn); border-color: #edd7b4; background: #fffaf2; }
.toast.ok { color: var(--accent); border-color: #b7dfd2; background: #f3fbf8; }
.toast.out { opacity: 0; transition: opacity 0.18s ease; }
.note { min-height: 0; margin-top: 6px; }
.supplies { margin-top: 8px; font-size: 13px; color: var(--warn); text-align: right; }
.supplies:empty { display: none; }
fieldset.pages { border: 0; margin: 12px 0 0; padding: 0; }
fieldset.pages:disabled { opacity: 0.55; }
details.more { margin-top: 12px; }
details.more > summary {
  display: inline-flex;
  align-items: center;
  list-style: none;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  background: transparent;
  color: var(--ink);
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary:hover { border-color: #8f8678; }
details.more > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.jobs-sheet-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.jobs-sheet-bar h2 { margin: 0 0 14px; flex: 1; }
.jobs-toolbar {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}
.jobs-filter { flex: 1; min-width: 0; }
#purgeDone {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 13px;
  padding: 10px 12px;
}
.jobs-launcher, #closeJobs { display: none; }
@media (max-width: 760px) {
  .grid { display: block; }
  header { gap: 8px; margin-bottom: 12px; }
  main { padding: 12px 12px 72px; }
  h1 { font-size: 22px; }
  .badge { display: inline-flex; margin-top: 0; padding: 4px 10px; font-size: 13px; }
  section { padding: 12px; border-radius: 12px; }
  h2 { margin-bottom: 8px; font-size: 15px; }
  label { margin: 8px 0 3px; font-size: 12px; }
  input, select, button {
    font-size: 16px;
    padding: 6px 8px;
    border-radius: 8px;
  }
  .row { gap: 8px; }
  .actions { margin-top: 10px; }
  #submit { padding: 12px 14px; border-radius: 10px; }
  .check { margin-top: 6px; font-size: 13px; gap: 8px; }
  .file-drop { padding: 8px; gap: 8px; font-size: 13px; }
  .file-button { padding: 6px 10px; font-size: 13px; }
  fieldset.pages { margin-top: 8px; }
  details.more { margin-top: 8px; }
  details.more > summary {
    font-size: 16px;
    padding: 6px 8px;
    border-radius: 8px;
  }
  #notify { margin-top: 6px !important; }
  .hint, .note { margin-top: 8px; }
  .jobs-launcher {
    display: inline-flex;
    align-items: center;
    position: fixed;
    right: 12px;
    bottom: 12px;
    z-index: 10;
    min-height: 40px;
    padding: 8px 14px;
    box-shadow: 0 8px 20px rgba(13, 122, 95, 0.32);
  }
  body:has(#jobsPanel.open) .jobs-launcher { display: none; }
  #jobsPanel { display: none; }
  #jobsPanel.open {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0;
    z-index: 30;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    max-height: 100dvh;
    overflow: hidden;
    padding: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  #jobsPanel.open .jobs-sheet-bar h2 { margin: 0; }
  #jobsPanel.open #closeJobs { display: inline-flex; padding: 6px 12px; }
  #jobsPanel.open .jobs-scroll {
    flex: 1;
    min-height: 0;
    max-height: none;
  }
  #purgeDone { padding: 6px 10px; }
  .job { padding: 10px; gap: 6px; }
  .job-foot { gap: 8px; }
  .file-type { font-size: 10px; padding: 1px 6px; }
  .state { font-size: 11px; min-width: 0; padding: 2px 7px; }
}
@keyframes toast-in {
  from { transform: translateY(-8px); }
  to { transform: none; }
}
@keyframes dot-pulse {
  50% { opacity: 0.35; }
}
@keyframes bar-flow {
  to { background-position: left 0 top 140%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
  
