:root {
  --orange: #f26a1b; --orange-dark: #c9520d; --ink: #1d1d1f; --muted: #6e6e73; --line: #e3e3e6;
  --bg: #f6f6f7; --card: #ffffff; --ok: #1f8a4c; --warn: #b26b00; --bad: #c0352b; --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
header { position: sticky; top: 0; z-index: 5; background: var(--ink); color: #fff; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 10px 16px 8px; padding-top: max(10px, env(safe-area-inset-top)); }
.brand { display: flex; align-items: center; color: #fff; }
svg.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
svg.logo { display: block; width: 196px; height: 21px; color: #fff; }
.login svg.logo { width: 262px; height: 28px; max-width: 100%; color: var(--ink); margin: 0 auto 22px; }
nav { order: 3; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; width: 100%; }
nav:empty { display: none; }
nav a { color: #ddd; text-decoration: none; padding: 8px 4px; border-radius: 8px; white-space: nowrap; font-size: 14px; text-align: center; overflow: hidden; text-overflow: ellipsis; }
nav a.on { background: #fff2; color: #fff; }
main { max-width: 760px; margin: 0 auto; padding: 16px 16px 80px; }
h1 { font-size: 22px; margin: 4px 0 14px; }
h2 { font-size: 17px; margin: 22px 0 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.row { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.list .card { cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.id { font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.big { font-size: 28px; font-weight: 700; }
label { display: block; font-size: 14px; color: var(--muted); margin: 12px 0 4px; }
input, select, textarea { width: 100%; font: inherit; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--orange); border-color: transparent; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 480px) { .grid2 { grid-template-columns: 1fr; } }
button, .btn { font: inherit; font-weight: 600; border: 0; border-radius: 10px; padding: 12px 16px; background: var(--orange); color: #fff; cursor: pointer; min-height: 46px; }
a.btn { display: inline-block; text-decoration: none; }
button:hover { background: var(--orange-dark); }
button.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
button.danger { background: #fff; color: var(--bad); border: 1px solid #f0c9c5; }
button.ghost, a.ghost { background: transparent; color: #fff; padding: 6px 10px; min-height: 0; text-decoration: none; font-weight: 600; border-radius: 10px; }
a.ghost.on { background: #fff2; }
header .tools { display: flex; align-items: center; gap: 2px; }
button:disabled { opacity: .45; cursor: default; }
button.wide { width: 100%; margin-top: 16px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: #eee; color: var(--ink); white-space: nowrap; }
.pill.open { background: #eef; color: #335; }
.pill.released, .pill.generating { background: #fff3e6; color: var(--warn); }
.pill.ready { background: #e7f3ff; color: #0b5cad; }
.pill.printing { background: #fff0e6; color: var(--orange-dark); }
.pill.done, .pill.ready_for_pickup { background: #e6f5ec; color: var(--ok); }
.pill.picked_up, .pill.cancelled { background: #eee; color: var(--muted); }
.pill.failed, .pill.scrap { background: #fdecea; color: var(--bad); }
.pill.online { background: #e6f5ec; color: var(--ok); }
.pill.offline { background: #fdecea; color: var(--bad); }
.bar { height: 8px; background: #eee; border-radius: 6px; overflow: hidden; margin-top: 8px; }
.bar > div { height: 100%; background: var(--orange); }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 2px solid var(--orange); border-radius: var(--radius); background: #fff8f3; margin-top: 12px; }
.check input { width: 26px; height: 26px; flex: none; accent-color: var(--orange); }
.check span { font-weight: 600; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; }
#toast.show { opacity: 1; }
#toast.bad { background: var(--bad); }
.filters { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; }
.filters button { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.token { font-family: ui-monospace, Menlo, monospace; word-break: break-all; background: #f3f3f3; padding: 10px; border-radius: 8px; user-select: all; }
.login { max-width: 380px; margin: 10vh auto 0; }
.lang { display: flex; gap: 8px; justify-content: center; margin-top: 18px; }
.lang button { min-height: 34px; padding: 4px 10px; font-size: 14px; }
.warn { background: #fff3e6; color: var(--warn); border: 1px solid #f5d3b0; border-radius: 10px; padding: 10px 12px; margin: 0 0 12px; font-size: 15px; }
.pill.kind { background: #efe7fb; color: #5b2d9e; }
.pill.online { background: #e6f5ec; color: var(--ok); }
.bad { color: var(--bad); font-weight: 600; }
.small-btn { min-height: 36px; padding: 6px 12px; font-size: 14px; margin-top: 8px; }
label.file { display: flex; justify-content: center; align-items: center; color: #fff; margin: 12px 0 0; cursor: pointer; }
label.file.secondary { color: var(--ink); }
.editor { position: relative; margin-top: 10px; border-radius: 10px; overflow: hidden; background: #000; }
.editor img { width: 100%; display: block; }
.editor svg { position: absolute; left: 0; top: 0; touch-action: none; }
.editor .pt circle { fill: var(--orange); stroke: #fff; stroke-width: 2; }
.editor .pt .halo { fill: rgba(242, 106, 27, .18); stroke: none; cursor: grab; }
.editor .pt text { fill: #fff; font-size: 13px; font-weight: 700; text-anchor: middle; paint-order: stroke; stroke: rgba(0, 0, 0, .6); stroke-width: 3px; pointer-events: none; }
.editor .meas { stroke: var(--orange); stroke-width: 2; stroke-dasharray: 6 4; }
.editor .poly { fill: rgba(242, 106, 27, .12); stroke: var(--orange); stroke-width: 2; }
.thumb { max-width: 100%; border-radius: 10px; margin-top: 8px; display: block; }
.cam { margin-top: 10px; }
.cam img { width: 100%; border-radius: 10px; display: block; margin-bottom: 4px; }
details summary { cursor: pointer; }
details.card summary { list-style: none; }
.mail { white-space: pre-wrap; font: 14px/1.45 inherit; background: #f6f6f7; padding: 10px; border-radius: 8px; margin: 10px 0 0; }
.steps { display: flex; gap: 4px; margin-top: 8px; font-size: 12px; }
.steps span { flex: 1; text-align: center; padding: 4px 2px; background: #eee; color: var(--muted); border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.steps span.on { background: #e6f5ec; color: var(--ok); font-weight: 600; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: right; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl th { color: var(--muted); font-weight: 500; font-size: 12px; }

/* adjustments (hardness, damping volume, width, sides): +/- steppers */
.adjust { margin-top: 4px; }
.adjrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.adjrow:last-child { border-bottom: 0; }
.adjrow > div:first-child { flex: 1; min-width: 0; }
.adjrow label { margin: 0; }
.adjrow .small { display: block; margin-top: 2px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; flex: none; }
.stepper button { width: 44px; height: 40px; padding: 0; border: 0; border-radius: 0; background: #f4f4f4; color: var(--ink); font-size: 22px; line-height: 1; }
.stepper button:disabled { color: #bbb; }
.stepper .val { min-width: 44px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.warnline { color: var(--warn); }
.rec { display: inline-block; color: #fff; background: var(--orange); padding: 2px 8px; border-radius: 6px; font-weight: 700; }
.limit { display: inline-block; color: var(--warn); background: #fff3e6; padding: 2px 8px; border-radius: 6px; font-weight: 700; }
