/* Auto-Print — clean, Vercel-inspired UI */

:root {
  --bg: #fafafa;
  --fg: #000000;
  --fg-2: #171717;
  --muted: #666666;
  --muted-2: #888888;
  --border: #eaeaea;
  --border-strong: #d4d4d4;
  --card: #ffffff;
  --hover: #f5f5f5;
  --accent: #0070f3;
  --ok: #0070f3;
  --ok-bg: #e8f1ff;
  --success: #16a34a;
  --error: #e5484d;
  --error-bg: #fff0f0;
  --warn: #f5a623;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.04);
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --fg: #ffffff;
    --fg-2: #ededed;
    --muted: #a1a1a1;
    --muted-2: #7d7d7d;
    --border: #1f1f1f;
    --border-strong: #333333;
    --card: #0a0a0a;
    --hover: #161616;
    --ok-bg: #0a1a33;
    --error-bg: #2a1011;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
}

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 960px;
  margin: 0 auto;
  height: 56px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.brand .mark { color: var(--fg); }

.status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-2);
  transition: background .2s, box-shadow .2s;
}
.dot.on { background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 18%, transparent); }
.dot.off { background: var(--error); }

/* ---------- Layout ---------- */
.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}
.hero {
  text-align: center;
  margin-bottom: 40px;
}
.hero h1 {
  margin: 0 0 10px;
  font-size: 40px;
  line-height: 1.1;
  letter-spacing: -0.04em;
  font-weight: 700;
}
.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}
.hero p span { color: var(--fg-2); font-weight: 500; }

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 32px; }
}

/* ---------- Card ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.muted-sm {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted-2);
}
.card-body { padding: 20px; }
.card-body.no-pad { padding: 0; }

/* ---------- Fields ---------- */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-2);
  margin-bottom: 6px;
}

input, select, textarea {
  width: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:focus, select:focus, textarea:focus {
  border-color: var(--fg);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--fg) 12%, transparent);
}
textarea { resize: vertical; min-height: 96px; }

.select-wrap { position: relative; }
.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  cursor: pointer;
}
.select-wrap .chev {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
select optgroup { font-weight: 600; color: var(--fg); }
select option { font-weight: 400; }

/* ---------- File list ---------- */
.file-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 13px;
  background: var(--card);
}
.file-item .file-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg);
}
.file-item.over { border-color: #e5484d; }
.file-item.over .file-meta { color: #e5484d; }
.file-rm {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.file-rm:hover { color: var(--fg); background: var(--hover); }

/* ---------- Dropzone ---------- */
.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 28px 16px;
  cursor: pointer;
  color: var(--muted);
  position: relative;
  transition: border-color .15s, background .15s, color .15s;
}
.drop svg { color: var(--muted-2); }
.drop small { font-size: 12px; color: var(--muted-2); }
.drop.hover {
  border-color: var(--fg);
  background: var(--hover);
  color: var(--fg);
}
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- Actions ---------- */
.actions {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: 18px;
}
.actions .copies { margin-bottom: 0; width: 96px; flex: 0 0 auto; }
.btn-primary {
  flex: 1;
  height: 40px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--fg);
  color: var(--bg);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity .15s, transform .05s;
}
.btn-primary:hover { opacity: .85; }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .5; cursor: default; }

.btn-secondary {
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, transform .05s;
}
.btn-secondary:hover { background: var(--hover); }
.btn-secondary:active { transform: translateY(1px); }

.copy-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.copy-row input { flex: 1; }
.copy-row #defaultRoute { flex: 1; }

.card.span-2 { grid-column: 1 / -1; }
@media (max-width: 760px) {
  .card.span-2 { grid-column: auto; }
}

/* ---------- Add-to-device address grid + OS tabs ---------- */
.addr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  margin-bottom: 18px;
}
.addr-grid .field { margin: 0; }
@media (max-width: 560px) {
  .addr-grid { grid-template-columns: 1fr; }
}

.os-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.os-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.os-tab:hover { color: var(--fg-2); }
.os-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.os-steps {
  margin: 0;
  padding-left: 20px;
  color: var(--fg-2);
  font-size: 13.5px;
  line-height: 1.65;
}
.os-steps li { margin: 4px 0; }
.os-steps li.note {
  list-style: none;
  margin-left: -20px;
  color: var(--muted);
  font-size: 12.5px;
}
.os-steps code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--hover);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
}

.msg {
  min-height: 18px;
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.msg.ok { color: var(--success); }
.msg.err { color: var(--error); }

/* ---------- Activity feed ---------- */
.jobs {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 520px;
  overflow-y: auto;
}
.job {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.job:last-child { border-bottom: none; }
.job .line1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.job .name {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job .line2 { font-size: 12px; color: var(--muted); }

.badge {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 999px;
  text-transform: lowercase;
  letter-spacing: .01em;
  border: 1px solid var(--border-strong);
  color: var(--muted);
}
.job.printed .badge { color: var(--success); border-color: color-mix(in srgb, var(--success) 35%, transparent); background: color-mix(in srgb, var(--success) 10%, transparent); }
.job.error .badge { color: var(--error); border-color: color-mix(in srgb, var(--error) 35%, transparent); background: var(--error-bg); }
.job.queued .badge, .job.printing .badge { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: var(--ok-bg); }

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted-2);
  font-size: 13px;
}

/* ---------- Footer ---------- */
.foot {
  text-align: center;
  margin-top: 40px;
  font-size: 12px;
  color: var(--muted-2);
}
