/* Mivena scanner: mobile first, one hand, gloves, bad light. Tokens, fonts and the two themes come
   from /ui/mivena.css (dark unless the person chose light in the app); big targets and strong
   contrast stay the scanner's own. */
:root {
  --r: 12px;
  font-size: 17px;
  line-height: 1.45;
  color: var(--text);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); }
body { letter-spacing: -0.006em; }
body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: contain; }
button, input, select { font: inherit; color: inherit; }

.app { min-height: 100dvh; display: flex; flex-direction: column; max-width: 640px; margin: 0 auto; }

.top {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg-deep); box-shadow: 0 1px 0 var(--line);
  padding: calc(env(safe-area-inset-top) + 8px) 16px 10px;
}
.brand-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
/* The wordmark with the ring and its copper electron, drawn in CSS (the screens are built in app.js). */
.brand { position: relative; display: inline-flex; align-items: center; gap: 7px; font-weight: 640; font-stretch: 108%; letter-spacing: -0.035em; text-transform: lowercase; color: var(--text); }
.brand::before { content: ''; flex: none; width: 13px; height: 13px; border: 2.5px solid currentColor; border-radius: 50%; }
.brand::after { content: ''; position: absolute; left: 7.5px; top: 50%; width: 5.5px; height: 5.5px; margin-top: -6.5px; border-radius: 50%; background: var(--copper); }
.title { font-size: 1.15rem; font-weight: 580; letter-spacing: -0.02em; margin: 0; flex: 1; }
.small { font-size: 0.85rem; }
.muted { color: var(--text-2); }

.scan-bar { display: flex; gap: 8px; margin-top: 8px; }
.scan-input {
  flex: 1; min-width: 0; min-height: 52px; padding: 0 14px;
  border: 2px solid var(--ion); border-radius: var(--r); background: var(--field); color: var(--text);
  font-family: var(--font-mono); font-size: 1rem;
}
.scan-input:focus { outline: none; box-shadow: 0 0 0 4px oklch(0.8 0.105 228 / 0.25); }
.icon-btn { min-width: 52px; min-height: 52px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--tint); color: var(--text); }
.icon-btn[aria-pressed='true'] { background: var(--info-bg); }

.status { margin-top: 8px; border-radius: var(--r); padding: 0; }
.status:empty { display: none; }
.status-ok, .status-error, .status-warn, .status-info { padding: 10px 14px; }
.status-ok { background: var(--success-bg); color: var(--success); box-shadow: inset 0 0 0 1px oklch(0.82 0.13 163 / 0.3); }
.status-error { background: var(--danger-bg); color: var(--danger-ink); box-shadow: inset 0 0 0 1px oklch(0.72 0.16 25 / 0.35); }
.status-warn { background: var(--attention-bg); color: var(--attention-ink); box-shadow: inset 0 0 0 1px oklch(0.73 0.155 50 / 0.3); }
.status-info { background: var(--info-bg); color: var(--text); }
.status-extra { font-size: 0.9rem; margin-top: 2px; }

.screen { flex: 1; padding: 12px 16px calc(84px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.hint { margin: 0; color: var(--text-2); }

.card { background: var(--glass), var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.card-title { font-weight: 580; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-top: 1px solid var(--line); }
.kv .k { color: var(--text-2); }
.kv .v { text-align: right; overflow-wrap: anywhere; }
.kv.em .v { font-weight: 700; }
.big-location {
  font-family: var(--font-mono); font-weight: 600;
  font-size: clamp(2rem, 11vw, 3.2rem); letter-spacing: 0.02em; line-height: 1.1;
}
.big-location.is-done { color: var(--success); }
.count-line { font-size: 2rem; font-weight: 600; font-family: var(--font-mono); letter-spacing: -0.02em; }
.step { font-weight: 600; }

.field { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; color: var(--text-2); }
.input { min-height: 48px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--field); color: var(--text); font-size: 1rem; }
.input:focus-visible { outline: none; border-color: transparent; box-shadow: var(--field-focus); }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; font-weight: 600; }
.check input { width: 24px; height: 24px; accent-color: var(--ion); }
.prompt { display: flex; flex-direction: column; gap: 8px; }
.prompt:empty { display: none; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  min-height: 48px; padding: 0 18px; border-radius: var(--r); border: 1px solid var(--line-2);
  background: var(--tint); color: var(--text); font-weight: 560; text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center; touch-action: manipulation; -webkit-user-select: none; user-select: none;
  transition: transform 160ms var(--ease-out), background-color 150ms ease;
}
.btn:active { transform: scale(0.97); }
.btn:focus-visible, .tab:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--ion); outline-offset: 2px; }
.btn-primary { background: var(--cta); border-color: transparent; color: var(--on-cta); font-weight: 600; }
.btn-warn { background: var(--attention-bg); border-color: oklch(0.73 0.155 50 / 0.5); color: var(--attention-ink); }
.btn-block { width: 100%; }

.bar { height: 8px; border-radius: 99px; background: var(--tint-2); overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--green); }
.w0 { width: 0; } .w10 { width: 10%; } .w20 { width: 20%; } .w30 { width: 30%; } .w40 { width: 40%; }
.w50 { width: 50%; } .w60 { width: 60%; } .w70 { width: 70%; } .w80 { width: 80%; } .w90 { width: 90%; } .w100 { width: 100%; }

.log { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); padding: 10px 14px; }
.log summary { cursor: pointer; font-weight: 600; min-height: 32px; }

/* A label prints black on white whatever the theme. */
.label-preview { width: 100%; max-width: 400px; align-self: center; background: #fff; border: 1px solid var(--line-2); border-radius: 6px; }

.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 2;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  background: var(--bg-deep); box-shadow: 0 -1px 0 var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  max-width: 640px; margin: 0 auto;
}
.tab { min-height: 60px; line-height: 1.2; border: 0; background: none; font-size: 0.8rem; font-weight: 560; color: var(--text-3); padding: 0 2px; }
.tab[aria-current='page'] { color: var(--text); box-shadow: inset 0 2px 0 var(--ion); }

@media (prefers-reduced-motion: reduce) { .btn:active { transform: none; } }
