/* Smart Print QR - APHD Theme
   Locked to Light Mode, Inter font, Blue/Purple accent */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #64748b;
  --line: #e2e8f0;
  --line-2: #f1f5f9;
  --bg: #f8fafc;
  --card: #ffffff;

  /* APHD Blue/Purple */
  --accent: #4f46e5;
  --accent-ink: #ffffff;
  --accent-soft: #e0e7ff;

  --wait: #b45309;
  --wait-soft: #fef3c7;
  --live: #4f46e5;
  --live-soft: #e0e7ff;
  --good: #157347;
  --good-soft: #dcfce7;
  --bad: #b3261e;
  --bad-soft: #fee2e2;

  --r: 12px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --tap: 48px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; letter-spacing: -.02em; line-height: 1.15; }
h1 { font-size: 1.55rem; font-weight: 680; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: .98rem; font-weight: 640; }
p { margin: 0; }
a { color: var(--accent); }

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ---------- layout ---------- */

.wrap { max-width: 48rem; margin: 0 auto; padding: 24px 16px 96px; }
.wrap-wide { max-width: 84rem; margin: 0 auto; padding: 24px 24px 64px; }

/* Dashboard Grid Layouts */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 768px) {
  .dash-grid-2 { grid-template-columns: repeat(2, 1fr); }
  .dash-grid-3 { grid-template-columns: repeat(3, 1fr); }
  .dash-layout { grid-template-columns: 320px 1fr; align-items: start; }
}

.global-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; min-height: 64px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
}
.global-header .logo-area { display: flex; align-items: center; gap: 12px; }
.global-header .logo-area img { height: 32px; }
.global-header .actions { display: flex; align-items: center; gap: 12px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 24px; }
.stack > * + * { margin-top: 24px; }

/* ---------- forms ---------- */

label { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }

input[type=text], input[type=email], input[type=password], input[type=number], select {
  width: 100%; min-height: var(--tap);
  padding: 11px 12px;
  font: inherit; color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
input::placeholder { color: var(--ink-3); }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, label:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.field + .field { margin-top: 14px; }
.hint { font-size: .78rem; color: var(--ink-3); margin-top: 6px; }

/* segmented choice: the whole tile is the tap target */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg-3 { grid-template-columns: repeat(3, 1fr); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  margin: 0; display: flex; align-items: center; justify-content: center;
  min-height: var(--tap); padding: 8px 10px;
  text-align: center; font-size: .92rem; font-weight: 600; color: var(--ink-2);
  background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r);
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.seg input:checked + label {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.seg input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

/* stepper */
.step { display: flex; align-items: center; gap: 12px; }
.step button {
  width: var(--tap); height: var(--tap); flex: none;
  font-size: 1.35rem; font-weight: 500; line-height: 1;
  color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r);
  cursor: pointer;
}
.step button:active { transform: scale(.97); }
.step output {
  flex: 1; text-align: center;
  font-size: 1.3rem; font-weight: 660;
  font-variant-numeric: tabular-nums;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 12px 20px;
  font: inherit; font-weight: 640;
  color: var(--accent-ink); background: var(--accent);
  border: 1px solid var(--accent); border-radius: var(--r);
  cursor: pointer; text-decoration: none;
  white-space: nowrap;
  transition: transform .1s, filter .12s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-wide { width: 100%; }

.btn-ghost {
  color: var(--ink); background: var(--card); border-color: var(--line);
}
.btn-ghost:hover { background: var(--line-2); filter: none; }

.btn-sm { min-height: 38px; padding: 7px 13px; font-size: .85rem; }
.btn-bad { color: var(--bad); background: var(--card); border-color: var(--line); }
.btn-bad:hover { background: var(--bad-soft); filter: none; }

/* ---------- file drop ---------- */

.drop {
  display: block; text-align: center; cursor: pointer;
  padding: 34px 20px;
  border: 2px dashed var(--line);
  border-radius: var(--r);
  background: var(--card);
  transition: border-color .12s, background .12s;
}
.drop:hover, .drop.hot { border-color: var(--accent); background: var(--accent-soft); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop .big { font-size: 1.02rem; font-weight: 650; }
.drop .small { font-size: .82rem; color: var(--ink-3); margin-top: 4px; }

/* ---------- price bar ---------- */

.pricebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 24px rgba(20, 22, 26, .07);
}
.pricebar .inner {
  max-width: 34rem; margin: 0 auto;
  display: flex; align-items: center; gap: 14px;
}
.pricebar .amt { flex: 1; min-width: 0; }
.pricebar .rs { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.pricebar .meta { font-size: .78rem; color: var(--ink-3); }

/* ---------- status pills ---------- */

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px;
  font-size: .76rem; font-weight: 700; letter-spacing: .01em;
  white-space: nowrap;
}
.pill-wait { color: var(--wait); background: var(--wait-soft); }
.pill-live { color: var(--live); background: var(--live-soft); }
.pill-good { color: var(--good); background: var(--good-soft); }
.pill-bad  { color: var(--bad);  background: var(--bad-soft); }

.dot { width: 7px; height: 7px; border-radius: 999px; background: currentColor; flex: none; }
.pill-live .dot { animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .3; } }

/* ---------- status page ---------- */

.ticket {
  text-align: center; padding: 26px 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
}
.ticket .lbl { font-size: .8rem; color: var(--ink-3); }
.ticket .no {
  font-size: 2.9rem; font-weight: 720; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; margin: 2px 0 10px;
}

.steps { list-style: none; margin: 0; padding: 0; }
.steps li {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 0; color: var(--ink-3);
}
.steps li + li { border-top: 1px solid var(--line-2); }
.steps .mark {
  width: 22px; height: 22px; flex: none; margin-top: 1px;
  display: grid; place-items: center;
  border-radius: 999px; font-size: .72rem; font-weight: 800;
  background: var(--line-2); color: var(--ink-3);
}
.steps li.on { color: var(--ink); font-weight: 600; }
.steps li.on .mark { background: var(--accent); color: var(--accent-ink); }
.steps li.past { color: var(--ink-2); }
.steps li.past .mark { background: var(--good-soft); color: var(--good); }

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--r);
  font-size: .88rem;
  background: var(--wait-soft); color: var(--wait);
  border: 1px solid transparent;
}
.notice-bad { background: var(--bad-soft); color: var(--bad); }
.notice strong { font-weight: 700; }

.rows { list-style: none; margin: 0; padding: 0; font-size: .88rem; }
.rows li { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; }
.rows li + li { border-top: 1px solid var(--line-2); }
.rows .k { color: var(--ink-3); }
.rows .v { font-weight: 600; text-align: right; }

/* ---------- admin ---------- */

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 13px 15px;
}
.stat .n { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .k { font-size: .76rem; color: var(--ink-3); margin-top: 2px; }

.jobs { display: grid; gap: 10px; }
.job {
  background: var(--card); border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: var(--r); padding: 14px 16px;
  display: grid; gap: 10px;
}
.job.s-PENDING  { border-left-color: var(--wait); }
.job.s-PRINTING { border-left-color: var(--live); }
.job.s-DONE     { border-left-color: var(--good); }
.job.s-FAILED, .job.s-REJECTED { border-left-color: var(--bad); }

.job .head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.job .tk { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.job .fn {
  flex: 1; min-width: 0; font-size: .88rem; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.job .spec { font-size: .82rem; color: var(--ink-3); }
.job .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.job .rs { font-weight: 700; font-variant-numeric: tabular-nums; }

.empty { text-align: center; padding: 48px 20px; color: var(--ink-3); }
.empty .big { font-size: 1.02rem; font-weight: 640; color: var(--ink-2); }

.bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 11px 14px; border-radius: var(--r);
  background: var(--card); border: 1px solid var(--line);
  font-size: .86rem; font-weight: 600;
}
.bar.off { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.bar.on { color: var(--good); }

details.settings { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
details.settings summary {
  padding: 14px 18px; cursor: pointer; font-weight: 640; font-size: .92rem;
}
details.settings .body { padding: 0 18px 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- landing ---------- */

.hero { padding: 76px 0 56px; }
.hero h1 {
  font-size: clamp(2.1rem, 6.4vw, 3.5rem); font-weight: 700;
  letter-spacing: -.035em; max-width: 20ch;
}
.hero p { font-size: 1.06rem; color: var(--ink-2); max-width: 46ch; margin-top: 16px; }
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }

.split { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; }

.flow { display: grid; gap: 0; counter-reset: n; }
.flow li { list-style: none; display: flex; gap: 16px; padding: 18px 0; }
.flow li + li { border-top: 1px solid var(--line); }
.flow .n {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  font-size: .84rem; font-weight: 800; font-variant-numeric: tabular-nums;
}
.flow h3 { margin-bottom: 3px; }
.flow p { font-size: .9rem; color: var(--ink-2); }

.sect { padding: 56px 0; border-top: 1px solid var(--line); }
.sect h2 { font-size: clamp(1.4rem, 3.6vw, 2rem); max-width: 24ch; }
.lede { color: var(--ink-2); margin-top: 12px; max-width: 52ch; }

.price-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 30px; box-shadow: var(--shadow);
}
.price-card .amt { font-size: 2.6rem; font-weight: 720; letter-spacing: -.03em; }
.price-card .per { font-size: .92rem; color: var(--ink-3); font-weight: 500; }
.price-card ul { list-style: none; margin: 18px 0 0; padding: 0; font-size: .92rem; }
.price-card li { padding: 7px 0; color: var(--ink-2); display: flex; gap: 9px; }
.price-card li::before { content: "✓"; color: var(--good); font-weight: 800; }

.foot {
  border-top: 1px solid var(--line); padding: 26px 0;
  font-size: .84rem; color: var(--ink-3);
  display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between;
}

/* ---------- qr poster ---------- */

.poster {
  background: #fff; color: #14161a;
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 42px 34px; text-align: center; max-width: 30rem; margin: 0 auto;
}
.poster h2 { font-size: 1.9rem; letter-spacing: -.03em; }
.poster .qr { margin: 22px auto 18px; display: block; width: 100%; max-width: 15rem; height: auto; }
.poster .rate { font-size: 1rem; color: #4c525c; }
.poster .url { font-size: .8rem; color: #7c828d; margin-top: 14px; word-break: break-all; }

.token {
  font: .8rem/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: var(--line-2); border: 1px solid var(--line); border-radius: var(--r);
  padding: 11px 13px; word-break: break-all; color: var(--ink-2);
}

/* ---------- misc ---------- */

.spin { display: none; }
.htmx-request .spin { display: inline-flex; }
.htmx-request .lbl-idle { display: none; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: .73rem; font-weight: 700; letter-spacing: .01em; white-space: nowrap;
  background: var(--line-2); color: var(--ink-3);
}
.badge-ok   { background: var(--good-soft); color: var(--good); }
.badge-warn { background: var(--wait-soft); color: var(--wait); }
.badge-bad  { background: var(--bad-soft);  color: var(--bad);  }

.btn-warn { color: var(--wait); background: var(--card); border-color: var(--line); }
.btn-warn:hover { background: var(--wait-soft); filter: none; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.center { text-align: center; }
.mt { margin-top: 18px; }
.muted { color: var(--ink-3); font-size: .84rem; }

@media (max-width: 760px) {
  .split { grid-template-columns: 1fr; gap: 32px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .hero { padding: 44px 0 36px; }
  .sect { padding: 40px 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@media print {
  .topbar, .pricebar, .no-print { display: none !important; }
  body { background: #fff; }
  .poster { border: none; max-width: none; }
}
