/* Palette: taken from the mark -- the deep teal of the scanner's body and the orange of its
   scan line, on a pale paper so the cards read as cards.

   Written for a phone first: one column, and every tap target at least 40px. */
:root {
  --hk-ink: #1b2a30;
  --hk-teal: #1f4e5f;
  --hk-teal-dark: #143642;
  --hk-orange: #f28c28;
  --hk-green: #2e7d4f;
  --hk-muted: #62737a;
  --hk-paper: #f2f5f6;
  --hk-card: #ffffff;
  --hk-line: #dce4e7;
  --hk-red: #b3261e;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

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

body {
  margin: 0;
  font-family: -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--hk-ink);
  background: var(--hk-paper);
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px 32px;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 12px; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }

a { color: var(--hk-teal); }
p { line-height: 1.5; }

.hint { color: var(--hk-muted); font-size: 0.9rem; }
.hint a { color: inherit; }
.error { color: var(--hk-red); }
.notice {
  background: #e3f1e8;
  color: var(--hk-green);
  border-radius: 10px;
  padding: 10px 14px;
}

.code { font-family: ui-monospace, Consolas, monospace; letter-spacing: 0.02em; }

.btn {
  display: inline-block;
  min-height: 42px;
  padding: 10px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--hk-teal);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn-secondary { background: var(--hk-line); color: var(--hk-ink); }
.btn-danger { background: var(--hk-red); }
.btn-small { min-height: 36px; padding: 6px 12px; font-size: 0.9rem; }

.field { display: block; margin: 0 0 14px; }
.field span { display: block; font-weight: 600; margin-bottom: 4px; }
.field input, .field select {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--hk-line);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}
.inline { display: inline-flex; align-items: center; gap: 6px; margin: 6px 14px 6px 0; }
.checkbox { margin-bottom: 12px; }

.back-link { margin-top: 20px; }

.card {
  background: var(--hk-card);
  border: 1px solid var(--hk-line);
  border-radius: 14px;
  padding: 18px;
  margin: 0 0 16px;
}
.card p:first-child { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }
.card-danger { border-color: #efc9c6; }
.card-cta { text-align: center; }
.card-list { padding: 0; }

.setting-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--hk-line);
  color: inherit;
  text-decoration: none;
}
.setting-row:last-child { border-bottom: 0; }
.setting-name { font-weight: 600; }

/* ---- home ---- */

.checklist { margin: 0; padding-left: 1.2em; }
.checklist li { margin: 6px 0; }
.checklist li.done { color: var(--hk-muted); text-decoration: line-through; }
.checklist li.done a { color: inherit; text-decoration: line-through; }

.mode {
  display: inline-block;
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  color: #fff;
  background: var(--hk-teal);
}
.mode-stock_in { background: var(--hk-green); }
.mode-stock_out { background: var(--hk-orange); }

.rows { list-style: none; margin: 0; padding: 0; }
.rows li {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--hk-line);
}
.rows li:last-child { border-bottom: 0; }
.rows li > a { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; width: 100%; }
.rows .what { font-weight: 600; flex: 1 1 60%; }
.rows .outcome { color: var(--hk-muted); flex: 1 1 60%; }
.rows .meta { color: var(--hk-muted); font-size: 0.85rem; }
.history li.is-failed .outcome { color: var(--hk-red); }

.device-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--hk-line);
}
.device-row .what { font-weight: 600; flex: 1 1 auto; }
.device-row .meta { color: var(--hk-muted); font-size: 0.85rem; flex: 1 1 100%; order: 3; }

.new-token {
  background: #fff6ec;
  border: 1px solid #f5d2ab;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.new-token pre { white-space: pre-wrap; word-break: break-all; font-size: 0.85rem; margin: 0; }

/* ---- printable codes ---- */

.code-sheet {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.code-label {
  margin: 0;
  padding: 14px;
  background: #fff;
  border: 1px dashed var(--hk-line);
  border-radius: 8px;
  text-align: center;
  break-inside: avoid;
}
.barcode { display: block; width: 100%; height: 70px; }
.code-label figcaption { margin-top: 8px; font-size: 0.9rem; }
.code-label figcaption .code { display: block; color: var(--hk-muted); font-size: 0.8rem; }

@media print {
  body { background: #fff; }
  .no-print, .back-link, .credits, .jtools-bar { display: none !important; }
  main { max-width: none; padding: 0; }
  .code-sheet { grid-template-columns: repeat(3, 1fr); }
}

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

.hero { text-align: center; margin: 8px 0 20px; }
.hero img { max-width: 100%; height: auto; }
.hero h1 { font-size: 2rem; margin-top: 12px; }
.hero-tagline { color: var(--hk-muted); font-size: 1.1rem; }
.steps { padding-left: 1.3em; }
.steps li { margin: 8px 0; line-height: 1.5; }

.credits { text-align: center; color: var(--hk-muted); font-size: 0.8rem; padding: 0 16px 24px; }
.credits a { color: inherit; }
