:root {
  --teal: #0f766e;
  --teal-dark: #115e59;
  --bg: #f5f5f4;
  --card: #ffffff;
  --line: #e2e2df;
  --text: #1c1917;
  --muted: #78716c;
  --red: #dc2626;
  --green: #16a34a;
  --yellow: #d97706;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

header {
  background: var(--teal);
  color: #fff;
  padding-top: env(safe-area-inset-top);
}
nav {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
}
nav .brand { font-weight: 700; }
nav a { color: #d1faf5; text-decoration: none; font-size: 15px; }
nav a.active { color: #fff; font-weight: 600; }
nav a.right { margin-left: auto; }

main { max-width: 640px; margin: 0 auto; padding: 16px; }

h1 { font-size: 22px; margin: 0 0 4px; }
h3 { font-size: 15px; margin: 18px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.big { font-size: 19px; font-weight: 600; }

button, .btn {
  appearance: none;
  border: none;
  background: var(--teal);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  padding: 13px 18px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
button:active, .btn:active { background: var(--teal-dark); }
button:disabled { opacity: .6; }
button.ghost, .btn.ghost { background: #fff; color: var(--teal); border: 1px solid var(--line); }

.row { display: flex; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.row button, .row .btn { flex: 1; min-width: 120px; }

input, select, textarea {
  width: 100%;
  font-size: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
}
.field { display: block; margin: 12px 0; font-size: 14px; color: var(--muted); }
.field input, .field select, .field textarea { margin-top: 5px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin: 12px 0;
}
.card-head { display: flex; align-items: center; gap: 10px; }
#o-number { font-size: 30px; font-weight: 800; line-height: 1.1; }
.pill {
  margin-left: auto;
  background: #f0fdfa;
  color: var(--teal-dark);
  border: 1px solid #99f6e4;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 600;
}

.items { list-style: none; padding: 0; margin: 6px 0; }
.items li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.items li:last-child { border-bottom: none; }

#video-wrap {
  position: relative;
  background: #000;
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 4 / 3;       /* flatter — matches a wide barcode */
  /* True full-bleed: span the whole viewport width regardless of main's padding */
  width: 100vw;
  margin: 12px calc(50% - 50vw);
}
#video { width: 100%; height: 100%; object-fit: cover; display: block; }
#scan-frame {
  position: absolute; inset: 18% 12%;
  border: 3px solid rgba(255,255,255,.8);
  border-radius: 10px;
  pointer-events: none;
}

.manual { margin-top: 14px; }
.manual summary { cursor: pointer; color: var(--teal); font-size: 14px; }

.ampel { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; margin: 8px 0; }
.ampel .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--muted); }
.ampel.green .dot { background: var(--green); } .ampel.green { color: var(--green); }
.ampel.yellow .dot { background: var(--yellow); } .ampel.yellow { color: var(--yellow); }
.ampel.red .dot { background: var(--red); } .ampel.red { color: var(--red); }

.flash { padding: 12px 14px; border-radius: 10px; margin: 10px 0; font-size: 15px; }
.flash.ok { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.flash.err { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.login { max-width: 340px; margin: 12vh auto 0; text-align: center; }
.login h1 { font-size: 28px; }
.login form { margin-top: 20px; display: grid; gap: 12px; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.tab {
  padding: 7px 12px; border-radius: 999px; text-decoration: none;
  background: #fff; border: 1px solid var(--line); color: var(--muted); font-size: 14px;
}
.tab.active { background: var(--teal); color: #fff; border-color: var(--teal); }
.tab .count { font-weight: 700; }

.refund-box textarea { margin: 8px 0; font-family: ui-monospace, monospace; }

table.returns { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; background: #fff; border-radius: 12px; overflow: hidden; }
table.returns th, table.returns td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); }
table.returns th { background: #fafaf9; color: var(--muted); font-weight: 600; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.photos img { width: 100%; height: 110px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }

.cat { display: inline-block; min-width: 22px; text-align: center; border-radius: 6px; padding: 2px 6px; font-weight: 700; }
.cat-A { background: #dcfce7; color: #166534; }
.cat-B { background: #fef9c3; color: #854d0e; }
.cat-C { background: #e0e7ff; color: #3730a3; }
.cat-D { background: #fee2e2; color: #991b1b; }
