:root { --bg:#f3f4f6; --card:#fff; --text:#111827; --muted:#6b7280; --line:#e5e7eb; --accent:#1f2937; --red:#dc2626; }
@media (prefers-color-scheme: dark) { :root { --bg:#0b0f14; --card:#151b23; --text:#e5e7eb; --muted:#9ca3af; --line:#263041; --accent:#e5e7eb; } }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
button, input, select { font: inherit; color: inherit; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 12px calc(24px + env(safe-area-inset-bottom)); }
.top { position: sticky; top: 0; z-index: 5; background: var(--accent); color: var(--bg); padding: calc(10px + env(safe-area-inset-top)) 12px 10px; display: flex; align-items: center; gap: 10px; }
.top h1 { font-size: 1.05rem; margin: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top button { background: transparent; border: 1px solid currentColor; color: inherit; border-radius: 8px; padding: 6px 10px; }
.login { max-width: 380px; margin: 14vh auto 0; padding: 0 16px; }
.login h1 { text-align: center; font-family: Georgia, serif; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
label { display: block; font-size: .85rem; color: var(--muted); margin: 10px 0 4px; }
input, select { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.btn { width: 100%; margin-top: 16px; padding: 13px; border: 0; border-radius: 10px; background: var(--accent); color: var(--bg); font-weight: 600; }
.btn:disabled { opacity: .5; }
.err { color: var(--red); font-size: .9rem; margin-top: 10px; min-height: 1.2em; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 0; }
.filters .full { grid-column: 1 / -1; }
.summary { color: var(--muted); font-size: .85rem; padding: 2px 2px 8px; }
.row { display: flex; gap: 12px; padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; align-items: center; }
.thumb { width: 60px; height: 80px; flex: none; border-radius: 8px; background: var(--line); object-fit: cover; }
.info { flex: 1; min-width: 0; }
.name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { color: var(--muted); font-size: .85rem; }
.size { display: inline-block; font-weight: 700; color: var(--text); }
.qty { flex: none; font-weight: 700; text-align: right; min-width: 3.2rem; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
#viewer { position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 20; display: flex; align-items: center; justify-content: center; }
#viewer[hidden] { display: none; }
#viewer img { max-width: 100%; max-height: 100%; }

/* modes, marks, scanning */
.tabs { display: flex; gap: 6px; padding: 10px 0 0; overflow-x: auto; }
.tab { flex: 1; min-width: 0; padding: 10px 6px; border: 1px solid var(--line); background: var(--card); border-radius: 10px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.tab.active { color: #fff; border-color: transparent; }
.tab-view { background: var(--accent); color: var(--bg); }
.tab-sale { background: #dc2626; }
.tab-return { background: #ea580c; }
.tab-count { background: #16a34a; }
.scanbar { display: flex; gap: 6px; padding-top: 10px; }
.scan-input { flex: 1; font-size: 1.1rem; }
.btn-small { flex: none; padding: 0 14px; border: 1px solid var(--line); background: var(--card); border-radius: 10px; font-weight: 600; cursor: pointer; }
#camera { margin-top: 8px; border-radius: 10px; overflow: hidden; background: #000; }
.feedback { margin-top: 8px; padding: 10px 12px; border-radius: 10px; font-weight: 600; }
.feedback[hidden] { display: none; }
.feedback-ok { background: #dcfce7; color: #14532d; }
.feedback-warn { background: #fef3c7; color: #78350f; }
.feedback-err { background: #fee2e2; color: #7f1d1d; }
.hint { color: var(--muted); font-size: .85rem; margin: 8px 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 10px; }
.chip { font-size: .8rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.chip-sale { background: #fee2e2; color: #991b1b; }
.chip-return { background: #ffedd5; color: #9a3412; }
.chip-count { background: #dcfce7; color: #166534; }
.row.clickable { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.row-sale { background: #fee2e2; border-color: #fca5a5; }
.row-return { background: #ffedd5; border-color: #fdba74; }
.row-count { background: #dcfce7; border-color: #86efac; }
.row-sale, .row-return, .row-count { color: #111827; }
.row-sale .meta, .row-return .meta, .row-count .meta { color: #4b5563; }
.cell-badges { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.badge { font-size: .7rem; font-weight: 700; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; color: #fff; white-space: nowrap; }
.badge-sale { background: #dc2626; }
.badge-return { background: #ea580c; }
.badge-count { background: #16a34a; }
.thumb { cursor: zoom-in; }

.chip-outside { background: #ede9fe; color: #5b21b6; }
.badge-outside { background: #7c3aed; }
.row-outside { border-style: dashed; border-color: #a78bfa; }

/* a computer: a wider page, filters in one line, the list as a table */
@media (min-width: 900px) {
  .wrap { max-width: 1100px; }
  .filters { grid-template-columns: 2fr repeat(5, 1fr); }
  .filters .full { grid-column: auto; }
  .tabs { max-width: 560px; }
  .row { display: grid; grid-template-columns: 60px 1fr 160px 90px; gap: 16px; }
  .scanbar { max-width: 560px; }
  .feedback { max-width: 560px; }
}
.indeks { font-weight: 700; color: var(--text); }
.outside-box { margin-top: 10px; padding: 10px; border: 1px dashed #a78bfa; border-radius: 12px; background: var(--card); }
.outside-box[hidden] { display: none; }
.outside-box summary { cursor: pointer; font-weight: 700; color: #5b21b6; margin-bottom: 8px; }
@media (prefers-color-scheme: dark) { .outside-box summary { color: #c4b5fd; } }
