:root {
  /* Matches the Exin webshop's Shopify theme (scheme-1): warm cream
     background, white surfaces, sage-green primary button, soft-pill
     button/input corners. */
  --bg: #FCF7F1;
  --surface: #FFFFFF;
  --ink: #000000;
  --muted: #666666;
  --line: #EDEDED;
  --accent: #B2C294;
  --accent-ink: #000000;
  --danger: #C4301C;
  --radius: 0.5rem;
  --buttons-radius: 1rem;
  --inputs-radius: 1rem;
  --font-family: "Funnel Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-family);
  -webkit-tap-highlight-color: transparent;
}

body { font-size: 16px; line-height: 1.45; }

h1, h2 { font-weight: 700; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.05rem; }

.muted { color: var(--muted); font-size: 0.88rem; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

input, select, textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--inputs-radius);
  background: var(--surface);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(178, 194, 148, 0.35);
}

textarea { resize: vertical; }

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}

.screen { min-height: 100vh; }

/* ---------- Start screen ---------- */
.start-wrap {
  max-width: 420px;
  margin: 0 auto;
  padding: 48px 20px 40px;
}
.brand-logo {
  height: 56px;
  width: auto;
  display: block;
  margin: 0 0 16px;
}
.start-wrap .lede {
  margin: 10px 0 16px;
  color: var(--muted);
}
.share-app-btn { margin-bottom: 32px; }
.start-block { margin-bottom: 8px; }
.start-block label { margin-top: 4px; }
.start-block input { margin-bottom: 12px; }

.start-divider {
  text-align: center;
  margin: 28px 0;
  position: relative;
  color: var(--muted);
  font-size: 0.85rem;
}
.start-divider::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  border-top: 1px solid var(--line);
}
.start-divider span {
  background: var(--bg);
  position: relative;
  padding: 0 12px;
}

.past-lists-section { margin-top: 36px; }
.past-lists-section h2 { margin-bottom: 12px; }
.past-lists { list-style: none; margin: 0; padding: 0; }
.past-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}
.past-list-open {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.past-list-name { font-weight: 700; color: var(--ink); }
.past-list-meta { color: var(--muted); font-size: 0.85rem; }
.past-list-remove {
  flex-shrink: 0;
  background: #F7EBDD;
  border: 1px solid var(--line);
  border-radius: var(--buttons-radius);
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 16px;
}
.past-list-remove:active { background: var(--line); }

/* ---------- Buttons ---------- */
.btn-primary, .btn-secondary, .btn-tertiary {
  border: none;
  border-radius: var(--buttons-radius);
  padding: 13px 18px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:active { background: #9dad80; }
.btn-secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn-secondary:active { background: var(--bg); }
.btn-tertiary { background: #F7EBDD; color: var(--ink); border: 1px solid var(--line); font-weight: 600; width: auto; padding: 8px 14px; font-size: 0.88rem; }
.btn-tertiary:active { background: var(--line); }

.icon-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--buttons-radius);
  padding: 8px 14px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--ink);
  transition: background 0.2s;
}
.icon-btn:active { background: var(--line); }

/* ---------- App screen ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.topbar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar-logo { height: 34px; width: auto; flex-shrink: 0; margin: 0; }
.topbar-actions { display: flex; gap: 8px; flex-shrink: 0; }
.topbar-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar-info h1 { font-size: 1.35rem; min-width: 0; }
.topbar-count {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--buttons-radius);
  padding: 4px 12px;
  white-space: nowrap;
}

.content {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px 60px;
}

/* ---------- Capture card ---------- */
.capture-card { margin-bottom: 36px; }

.photo-picker { display: block; cursor: pointer; margin-bottom: 16px; }
.photo-empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-weight: 600;
}
.photo-camera-icon { width: 56px; height: 56px; filter: drop-shadow(0 4px 5px rgba(0,0,0,0.3)); }
.photo-preview {
  width: 100%;
  height: 220px;
  object-fit: contain;
  background: var(--surface);
  border-radius: var(--radius);
  display: block;
}

.product-form .field { margin-bottom: 14px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

.dims-row { display: flex; align-items: center; gap: 8px; }
.dims-x { color: var(--muted); }

/* ---------- List section ---------- */
.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 10px;
}
.export-actions { display: flex; gap: 8px; }

.product-list { list-style: none; margin: 0; padding: 0; }
.product-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.product-main {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
}
.product-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--line);
  flex-shrink: 0;
}
.product-info { flex: 1; min-width: 0; }
.product-info .pname { font-weight: 700; }
.product-info .pmeta { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.product-remove {
  flex-shrink: 0;
  background: #F7EBDD;
  border: 1px solid var(--line);
  border-radius: var(--buttons-radius);
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 16px;
}
.product-remove:active { background: var(--line); }

.cancel-edit-btn { width: 100%; margin-top: 10px; }

.empty-state { padding: 20px 0; text-align: center; }

/* ---------- Share sheet ---------- */
.sheet {
  position: fixed;
  inset: 0;
  background: rgba(30,30,27,0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 20;
}
.sheet-inner {
  background: var(--bg);
  width: 100%;
  max-width: 460px;
  border-radius: 12px 12px 0 0;
  padding: 24px 20px 32px;
  text-align: center;
}
.share-code {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 16px 0;
  color: var(--danger);
}
.share-qr {
  width: 180px;
  height: 180px;
  margin: 0 auto 20px;
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.sheet-inner .btn-primary, .sheet-inner .btn-secondary { margin-bottom: 10px; }

@media (min-width: 640px) {
  .sheet { align-items: center; }
  .sheet-inner { border-radius: 12px; }
}
