* { box-sizing: border-box; }

:root {
  --bg: #0e131a;
  --card: #1a222c;
  --ink: #e6edf3;
  --muted: #9aa7b4;
  --line: #2a3542;
  --primary: #c9a227;
  --primary-soft: #c9a227;
  --ok: #3fb950;
  --ok-bg: rgba(63, 185, 80, .15);
  --miss: #f85149;
  --miss-bg: rgba(248, 81, 73, .15);
  --extra: #d29922;
  --extra-bg: rgba(210, 153, 34, .16);
  --pend: #8b949e;
  --pend-bg: rgba(139, 148, 158, .16);
  --radius: 14px;
  --shadow: 0 1px 4px rgba(0, 0, 0, .35);
}

html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- header ---------- */
.top {
  padding: calc(14px + env(safe-area-inset-top)) 16px 10px;
  background: #0b1016;
  color: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; max-width: 760px; margin: 0 auto; }
.top-title { font-size: 18px; margin: 0; font-weight: 700; }
.subtitle { color: #8b98a5; font-size: 14px; margin: 8px 0 0; }
.meta { margin-top: 8px; font-size: 14px; max-width: 760px; margin-left: auto; margin-right: auto; }
.meta-line { margin: 2px 0; }
.meta .dim { color: #8b98a5; }
.worker-row {
  display: flex; align-items: center; gap: 10px;
  max-width: 760px; margin: 10px auto 0;
  background: #121821;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
}
.worker-label { font-size: 14px; color: var(--muted); white-space: nowrap; }
.worker-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 8px 12px;
  font-size: 16px;
  font-weight: 700;
  color: #c9a227;
  background: #0e131a;
  border: 2px solid var(--line);
  border-radius: 9px;
  text-align: center;
  letter-spacing: .5px;
}
.worker-input::placeholder { color: #5b6572; font-weight: 400; }
.worker-input:focus { outline: none; border-color: var(--primary); }
.btn-ghost-spacer { width: 64px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary { background: var(--primary); color: #0e131a; width: 100%; }
.btn-primary:active { background: #a8891f; }
.btn-ghost { background: transparent; color: #fff; border: 1px solid #ffffff55; padding: 6px 12px; font-size: 14px; }

/* ---------- progress ---------- */
.progress-wrap { padding: 12px 16px 0; max-width: 760px; margin: 0 auto; width: 100%; }
.progress-bar {
  background: var(--line);
  border-radius: 999px;
  height: 22px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2f9e44, #51cf66);
  transition: width .3s ease;
  border-radius: 999px;
}
.progress-text { text-align: center; margin-top: 6px; font-size: 15px; font-weight: 600; color: var(--muted); }

.badges { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 16px 0; max-width: 760px; margin: 0 auto; width: 100%; }
.chip {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.chip-ok { background: var(--ok-bg); color: var(--ok); }
.chip-miss { background: var(--miss-bg); color: var(--miss); }
.chip-extra { background: var(--extra-bg); color: var(--extra); }
.chip-pend { background: var(--pend-bg); color: var(--pend); }
.chip-finished { background: rgba(201, 162, 39, .15); color: var(--primary-soft); }
.chip-progress { background: rgba(201, 162, 39, .15); color: var(--primary-soft); }
.chip-mine { background: var(--primary); color: #0e131a; }
.home-worker { margin-top: 12px; }
.home-worker-note { font-size: 14px; color: var(--ok); font-weight: 600; margin-top: 8px; }
.list-row-mine { display: none; color: var(--ok); font-weight: 800; font-size: 12px; margin-top: 2px; }
.list-row.mine .list-row-mine { display: block; }

/* ---------- items ---------- */
.items { padding: 12px 12px 140px; display: flex; flex-direction: column; gap: 10px; max-width: 760px; margin: 0 auto; width: 100%; }

.item {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px;
  border: 2px solid var(--line);
  box-shadow: var(--shadow);
}
.item.packed { border-color: rgba(63, 185, 80, .45); background: #16231b; }
.item.missing { border-color: rgba(248, 81, 73, .45); background: #241717; }
.item.extra { border-color: rgba(210, 153, 34, .45); background: #231d12; }

.item-head { display: flex; align-items: center; gap: 10px; }
.item-num {
  width: 34px; height: 34px; min-width: 34px;
  border-radius: 9px;
  background: rgba(201, 162, 39, .16); color: var(--primary-soft);
  font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.item-check {
  width: 34px; height: 34px; min-width: 34px;
  accent-color: var(--ok);
  transform: scale(1.25);
  cursor: pointer;
}
.item-title { flex: 1; min-width: 0; }
.item-name { font-weight: 600; font-size: 15px; }
.item-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.indeks-val { color: #e6b822; font-weight: 800; font-size: 14px; }

.item-qty {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px; padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.qty-label { font-size: 13px; color: var(--muted); }
.qty-required { font-weight: 700; }
.qty-input {
  width: 90px;
  padding: 10px;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  color: var(--ink);
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #0e131a;
}
.qty-input:focus { outline: none; border-color: var(--primary); }

.item-status { margin-left: auto; }
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}
.status-badge.ok { background: var(--ok-bg); color: var(--ok); }
.status-badge.missing { background: var(--miss-bg); color: var(--miss); }
.status-badge.extra { background: var(--extra-bg); color: var(--extra); }
.status-badge.pending { background: var(--pend-bg); color: var(--pend); }

.item-parts { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.parts-head { font-size: 13px; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.parts-progress { color: var(--primary-soft); }
.part-row {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  margin-bottom: 6px;
  background: #121821;
  cursor: pointer;
  font-size: 13px;
}
.part-row:last-child { margin-bottom: 0; }
.part-row input { accent-color: var(--ok); transform: scale(1.15); cursor: pointer; flex-shrink: 0; }
.part-text { flex: 1; min-width: 0; }
.part-row.done { border-color: rgba(63, 185, 80, .4); background: rgba(63, 185, 80, .08); }
.part-row.done .part-text { color: var(--muted); text-decoration: line-through; }

.item-photo-add { margin-top: 10px; }
.photo-add {
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px dashed var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--muted); font-size: 13px; font-weight: 600;
  cursor: pointer;
  background: #121821;
}
.photo-add:active { background: var(--line); }
.photo-add input { display: none; }

.item-photos { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.photo-wrap { position: relative; }
.photo-img {
  width: 86px; height: 86px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0e131a;
  display: block;
}
.photo-del {
  position: absolute; top: -7px; right: -7px;
  width: 24px; height: 24px;
  border-radius: 50%;
  border: none;
  background: var(--miss);
  color: #fff;
  font-size: 15px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.photo-del:active { background: #d63b34; }

/* ---------- bottom / finish ---------- */
.bottom {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: rgba(14, 19, 26, .92);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  z-index: 30;
}
.bottom .btn-primary { display: block; max-width: 760px; margin: 0 auto; }
.bottom-top { display: flex; justify-content: flex-end; max-width: 760px; margin: 0 auto 6px; }
.btn-collapse {
  display: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 13px;
  cursor: pointer;
}
.btn-collapse:active { background: var(--line); }
.btn-show-panel {
  position: fixed;
  bottom: 14px;
  right: 14px;
  z-index: 40;
  background: var(--primary);
  color: #0e131a;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .4);
}
body.panel-hidden .items { padding-bottom: 24px; }
.drive-folder-row {
  display: flex; align-items: center; gap: 10px;
  max-width: 760px; margin: 0 auto 8px;
}
.drive-folder-label { font-size: 14px; color: var(--muted); white-space: nowrap; }
.drive-folder-input {
  flex: 1; min-width: 0;
  padding: 9px 12px;
  font-size: 15px;
  color: var(--ink);
  background: #0e131a;
  border: 2px solid var(--line);
  border-radius: 9px;
  outline: none;
}
.drive-folder-input::placeholder { color: #5b6572; }
.drive-folder-input:focus { border-color: var(--primary); }
.btn-ghost-dark {
  display: block;
  max-width: 760px;
  margin: 8px auto 0;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.btn-ghost-dark:active { background: var(--line); }
.finish-msg { text-align: center; margin-top: 8px; font-weight: 600; }
.sync-msg { text-align: center; margin-top: 6px; font-size: 13px; color: var(--muted); }
.sync-msg .sync-line { display: block; margin-top: 2px; }
.sync-msg.ok { color: var(--ok); }
.sync-msg.miss { color: var(--miss); }
.link { color: var(--primary-soft); }
.finish-msg.ok { color: var(--ok); }
.finish-msg.miss { color: var(--miss); }
.finish-msg .btn-back { display: inline-block; margin-top: 10px; margin-left: 8px; }

/* ---------- home ---------- */
.home { padding: 16px; display: flex; flex-direction: column; gap: 16px; max-width: 620px; margin: 0 auto; width: 100%; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 12px; font-size: 17px; }
.addr-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.addr-row {
  display: flex; align-items: center; justify-content: center;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #121821;
  color: #c9a227;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  word-break: break-all;
  text-align: center;
}
.addr-row:active { background: var(--line); }
.qr-wrap { margin-top: 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.qr-img {
  width: 200px; height: 200px;
  background: #fff;
  padding: 8px;
  border-radius: 12px;
}
.qr-note { font-size: 13px; color: var(--muted); }
.upload-form { display: flex; flex-direction: column; gap: 10px; }
.file-btn {
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  background: #121821;
}
.file-btn input { display: none; }
.hint { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
code { background: #0e131a; padding: 1px 5px; border-radius: 5px; color: var(--primary-soft); }

.list-rows { display: flex; flex-direction: column; gap: 8px; }
.list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  background: #171f29;
}
.list-row:active { background: #1f2937; }
.list-row.mine { border-color: var(--primary); background: #1d2430; }
.list-row-worker { font-size: 12px; color: var(--muted); margin-top: 2px; }
.list-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.list-row-no { font-size: 20px; font-weight: 800; }
.list-row-client { font-size: 18px; font-weight: 700; line-height: 1.15; }
.list-row-sub { font-size: 13px; color: var(--muted); }
.report-row { background: #171f29; }
.report-link {
  flex: 1; min-width: 0;
  text-decoration: none;
  color: var(--ink);
  font-size: 14px;
  word-break: break-all;
}
.btn-del {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--miss);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-del:active { background: var(--miss-bg); }
.empty { color: var(--muted); }
