/* Proclean Linen Tracking
   Built for one-handed use on a phone, in a corridor, sometimes in gloves.
   Touch targets are 48px minimum and the primary action is always thumb-reachable. */

:root {
  --teal-900: #072f36;
  --teal-800: #0d4a54;
  --teal-700: #14606d;
  --teal-100: #d9ecef;
  --accent:   #17a398;
  --accent-dark: #0f7a72;
  --ink:      #10262b;
  --ink-soft: #3d565c;
  --muted:    #5d7176;
  --line:     #d5e0e2;
  --bg:       #f4f8f8;
  --card:     #ffffff;
  --danger:   #b3261e;
  --warn:     #8a5a00;
  --warn-bg:  #fff4dc;
  --ok:       #1b7f5a;
  --ok-bg:    #e3f5ec;
  --radius:   14px;
  --shadow:   0 1px 2px rgba(7,47,54,.08), 0 4px 16px rgba(7,47,54,.06);
  --safe-b:   env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: contain;
}

/* ---------- chrome ---------- */

/* Banner and topbar share one sticky container. Sticking them both at top:0
   independently made the offline banner cover the cart context while scrolling -
   and offline is the normal case for this app, not the exception. */
.header-stack {
  position: sticky;
  top: 0;
  z-index: 30;
}

.net-banner {
  background: var(--warn-bg);
  color: var(--warn);
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  border-bottom: 1px solid #f0dfb5;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-top, 0px));
  padding-top: max(12px, env(safe-area-inset-top, 0px));
  background: var(--teal-800);
  color: #fff;
}

.topbar-title { flex: 1; min-width: 0; }
.topbar-title strong { display: block; font-size: 17px; letter-spacing: -.01em; }
.topbar-sub {
  display: block;
  font-size: 13px;
  color: var(--teal-100);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: rgba(255,255,255,.14);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;              /* flex swallows the whitespace between the count and the word */
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.16);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.chip.has-pending { background: var(--accent); }

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px calc(24px + var(--safe-b));
}

/* ---------- primitives ---------- */

h1 { font-size: 24px; margin: 4px 0 4px; letter-spacing: -.02em; }
h2 { font-size: 18px; margin: 24px 0 10px; }
p.lede { color: var(--muted); margin: 0 0 20px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }

input[type=text], input[type=password], input[type=search], select {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 17px; /* 16px+ stops iOS zooming the viewport on focus */
  color: var(--ink);
}
input:focus, select:focus, button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 56px;
  padding: 14px 18px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}
.btn:active { background: var(--accent-dark); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--teal-800); border: 1.5px solid var(--line); }
.btn.ghost { background: transparent; color: var(--teal-700); font-weight: 600; min-height: 48px; }
.btn.danger { background: var(--danger); }
.btn + .btn { margin-top: 10px; }
.btn-lg { min-height: 68px; font-size: 19px; }

.notice { padding: 12px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 14px; }
.notice.error { background: #fdecea; color: var(--danger); border: 1px solid #f5c6c2; }
.notice.ok    { background: var(--ok-bg); color: var(--ok); border: 1px solid #bfe6d4; }
.notice.warn  { background: var(--warn-bg); color: var(--warn); border: 1px solid #f0dfb5; }

/* ---------- lists ---------- */

.list { list-style: none; margin: 0; padding: 0; }
.list li + li { border-top: 1px solid var(--line); }

.list-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 14px 4px;
  border: 0;
  background: none;
  font-size: 17px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.list-btn .sub { display: block; font-size: 13px; color: var(--muted); font-weight: 400; }

/* ---------- scanner ---------- */

.scan-frame {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  aspect-ratio: 3 / 4;
  margin-bottom: 14px;
}
.scan-frame video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame canvas { display: none; }
.scan-reticle {
  position: absolute;
  inset: 18% 12%;
  border: 3px solid rgba(255,255,255,.9);
  border-radius: 12px;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.35);
}

/* ---------- standard / counts ---------- */

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }

.count-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 12px;
  align-items: center;
  padding: 14px 0;
}
.count-row + .count-row { border-top: 1px solid var(--line); }
.count-name { font-weight: 600; font-size: 16px; }
.count-meta { font-size: 13px; color: var(--muted); }

.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button {
  width: 48px;
  height: 48px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 22px;
  font-weight: 700;
  color: var(--teal-800);
  cursor: pointer;
}
.stepper button:active { background: var(--teal-100); }
.stepper input {
  width: 62px;
  min-height: 48px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 0;
}
.count-row.has-return .count-name::after {
  content: " returned";
  font-weight: 400;
  color: var(--accent-dark);
  font-size: 13px;
}

/* ---------- signature ---------- */

.sig-wrap {
  position: relative;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: #fff;
  height: 200px;
  overflow: hidden;
  touch-action: none; /* the pad owns the gesture, not the scroller */
}
.sig-wrap canvas { width: 100%; height: 100%; display: block; }
.sig-wrap.signed { border-style: solid; border-color: var(--accent); }
.sig-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 15px;
  pointer-events: none;
}
.sig-wrap.signed .sig-placeholder { display: none; }

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

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
}
.badge.pending { background: var(--warn-bg); color: var(--warn); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }

.empty { text-align: center; padding: 44px 16px; color: var(--muted); }
.row-split { display: flex; gap: 10px; }
.row-split > * { flex: 1; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }
.spacer { height: 10px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- photo capture (Day 2) ---------- */

.photo-thumb {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin-bottom: 12px;
  background: var(--teal-100);
}

.badge.blocked { background: #fdecea; color: var(--danger); }
.danger-text { color: var(--danger) !important; }
