:root {
  --ink: #1c2333;
  --ink-2: #3a4258;
  --muted: #6f6a60;
  --paper: #f6f1e7;
  --card: #fffdf8;
  --line: #e2d9c7;
  --brass: #a8813f;
  --brass-soft: #f1e6cf;
  --ok: #2f6b4f;
  --warn: #a6541c;
  --warn-soft: #fbe9dc;
  --radius: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.45 var(--sans); }
body { padding-bottom: env(safe-area-inset-bottom); }
a { color: var(--ink); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: .01em; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
.muted { color: var(--muted); } .center { text-align: center; } .pad { padding: 2rem 1rem; }
.small { font-size: .85rem; }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; padding: .7rem 16px; padding-top: calc(.7rem + env(safe-area-inset-top)); background: var(--ink); color: var(--paper); }
.brand { font-family: var(--serif); font-size: 1.25rem; color: var(--paper); text-decoration: none; letter-spacing: .03em; }
.brand span { color: var(--brass); }
.topbar nav { display: flex; gap: .1rem; overflow-x: auto; scrollbar-width: none; }
.topbar nav a, .topbar nav button { color: var(--paper); text-decoration: none; font-size: .85rem; padding: .35rem .5rem; white-space: nowrap;
  border-radius: 8px; background: none; border: 0; cursor: pointer; font-family: var(--sans); }
.topbar nav a.active { background: rgba(255,255,255,.12); }

main { max-width: 760px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
@media (max-width: 420px) { .grid3 { grid-template-columns: 1fr 1fr; } }

label { display: block; font-size: .85rem; color: var(--ink-2); margin-bottom: .6rem; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: .65rem .75rem; margin-top: .25rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brass); outline-offset: 1px; border-color: var(--brass); }
textarea { min-height: 80px; resize: vertical; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-size: .9rem; }
.check input { width: auto; margin-top: .2rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: 600 .95rem var(--sans);
  padding: .7rem 1.1rem; border-radius: 10px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  cursor: pointer; text-decoration: none; min-height: 44px; }
.btn.secondary { background: transparent; color: var(--ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.danger { background: transparent; color: var(--warn); border-color: var(--warn); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list a.item { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .8rem .2rem; text-decoration: none; }
.item .title { font-weight: 600; }
.chev { color: var(--muted); }

.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px;
  background: var(--brass-soft); color: #6b5022; white-space: nowrap; }
.badge.ok { background: #dcefe4; color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.grey { background: #ece7dc; color: var(--muted); }

.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .45rem .85rem; font: 500 .9rem var(--sans);
  cursor: pointer; color: var(--ink); min-height: 40px; }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* wizard */
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin: .4rem 0 1rem; }
.progress > div { height: 100%; background: var(--brass); transition: width .2s; }
.step-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.code { font: 600 .8rem var(--sans); color: var(--brass); letter-spacing: .05em; }
.step-img { width: 100%; max-height: 28vh; object-fit: contain; background: #e9e2d3; border-radius: 12px; display: block; margin: .6rem 0; }
.how { font-size: .95rem; color: var(--ink-2); }
.reading input { font-size: 1.4rem; font-weight: 600; text-align: center; padding: .55rem; }
.unit-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.unit-switch button { border: 0; background: #fff; padding: .35rem .8rem; font: 600 .85rem var(--sans); cursor: pointer; color: var(--ink); }
.unit-switch button.on { background: var(--ink); color: var(--paper); }
.warnbox { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: .6rem .8rem; font-size: .9rem; margin: .6rem 0; }
.wiz-nav { position: sticky; bottom: 0; display: flex; gap: .6rem; padding: .8rem 0 calc(.8rem + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--paper) 30%); }
.wiz-nav .btn { flex: 1; }
.dots { display: flex; gap: 4px; flex-wrap: wrap; margin-top: .4rem; }
.dots button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font: 600 .7rem var(--sans);
  cursor: pointer; color: var(--ink-2); padding: 0; }
.dots button.done { background: var(--brass-soft); border-color: var(--brass); }
.dots button.cur { outline: 2px solid var(--ink); }
.dots button.bad { background: var(--warn-soft); border-color: var(--warn); }

table.vals { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.vals th, table.vals td { text-align: left; padding: .45rem .3rem; border-bottom: 1px solid var(--line); }
table.vals td.num, table.vals th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.photo { position: relative; aspect-ratio: 3/4; background: #e9e2d3; border-radius: 10px; overflow: hidden; display: flex;
  align-items: center; justify-content: center; text-align: center; font-size: .85rem; color: var(--muted); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo .lbl { position: absolute; left: 6px; bottom: 6px; background: rgba(28,35,51,.8); color: #fff; font-size: .72rem; padding: .1rem .45rem; border-radius: 6px; }
.photo .del { position: absolute; right: 4px; top: 4px; background: rgba(255,255,255,.9); border: 0; border-radius: 6px; cursor: pointer; padding: .15rem .4rem; }
.photo label { margin: 0; cursor: pointer; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; flex-direction: column; }
.photo input { display: none; }

#toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink);
  color: var(--paper); padding: .6rem 1rem; border-radius: 10px; font-size: .9rem; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; z-index: 50; }
#toast.show { opacity: 1; }
#toast.err { background: var(--warn); }

.login-wrap { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; max-width: 380px; margin: 0 auto; }
.login-wrap .brand { color: var(--ink); font-size: 2.2rem; text-align: center; display: block; margin-bottom: .2rem; }

/* order card for Kris */
.sheet { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 1.2rem; font-size: .92rem; }
.sheet h2 { margin-bottom: .1rem; }
.sheet .meta { display: grid; grid-template-columns: 1fr 1fr; gap: .2rem 1rem; margin: .6rem 0 1rem; }
.sheet .meta div span { color: var(--muted); }
.sheet .photos { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 520px) { .sheet .meta { grid-template-columns: 1fr; } .sheet { padding: .9rem; } }
@media (max-width: 400px) { .brand { font-size: 1.05rem; } .topbar nav a { padding: .3rem .35rem; font-size: .8rem; } }

@media print {
  body { background: #fff; }
  .topbar, .noprint, #toast { display: none !important; }
  main { max-width: none; padding: 0; }
  .sheet { border: 0; padding: 0; }
  .card { border: 0; }
}
