/* Nevorika Orders — mobile-first, minimal */
:root {
  --bg: #f4f5f8; --card: #fff; --ink: #1d2433; --muted: #6b7385; --line: #e3e6ed;
  --brand: #1f2a44; --primary: #2f6fed; --primary-ink: #fff;
  --red: #d93636; --red-bg: #fdecec; --green: #1f9d55; --green-bg: #e8f7ee;
  --amber: #a86200; --amber-bg: #fff3dc; --blue: #2457c5; --blue-bg: #e8f0ff;
  --purple: #6b3fc4; --purple-bg: #f1ebff; --grey-bg: #eef0f4;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif; }
a { color: var(--primary); text-decoration: none; }
h1 { font-size: 1.35rem; margin: 6px 0 14px; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }
code { background: var(--grey-bg); padding: 2px 6px; border-radius: 6px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.red { color: var(--red); }
.inline { display: inline; margin: 0; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--brand); color: #fff;
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; flex-wrap: wrap; }
.brand { color: #fff; font-weight: 800; font-size: 1.05rem; margin-right: auto; }
.brand span, .login-brand span { font-weight: 400; opacity: .75; margin-left: 4px; }
.nav { display: flex; gap: 2px; overflow-x: auto; align-items: center; max-width: 100%; }
@media (max-width: 480px) { .nav { width: 100%; } .nav a, .linkbtn { padding: 8px 9px; font-size: .9rem; } }
.nav a, .linkbtn { color: #dfe5f3; padding: 8px 10px; border-radius: 8px; white-space: nowrap; font-size: .95rem;
  background: none; border: 0; font: inherit; cursor: pointer; }
.nav a.on, .nav a:hover, .linkbtn:hover { background: rgba(255,255,255,.14); color: #fff; }

.wrap { max-width: 980px; margin: 0 auto; padding: 14px 12px 110px; }
.wrap.narrow { max-width: 520px; }

/* Cards & forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card.empty { text-align: center; padding: 30px 16px; }
.lbl { display: block; font-weight: 600; font-size: .9rem; margin: 12px 0 6px; }
.input { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #cfd4de; border-radius: 10px;
  font: inherit; background: #fff; color: var(--ink); }
.input:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
.input-sm { width: 90px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 10px 18px;
  border-radius: 10px; border: 1px solid #cfd4de; background: #fff; color: var(--ink); font: inherit; font-weight: 600;
  cursor: pointer; text-align: center; }
.btn:hover { background: var(--grey-bg); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: #255fd4; }
.btn-danger { color: var(--red); border-color: #f0b8b8; }
.btn-sm { min-height: 38px; padding: 6px 12px; font-size: .9rem; }
.btn-block { width: 100%; margin-top: 16px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.row-gap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wrap-row { flex-wrap: wrap; }
.grow { flex: 1 1 160px; min-width: 0; }
.top-gap { margin-top: 12px; }

.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; background: var(--green-bg); color: #145c33; }
.flash-err { background: var(--red-bg); color: #8e1f1f; }

/* Login */
.login { max-width: 400px; margin: 8vh auto 0; }
.login-brand { text-align: center; font-size: 1.6rem; font-weight: 800; color: var(--brand); margin-bottom: 18px; }

/* Setup checks */
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { padding: 4px 0; }
.checks .ok { color: var(--green); }
.checks .bad { color: var(--red); font-weight: 600; }

/* Upload */
.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; margin-top: 14px;
  border: 2px dashed #b9c3d8; border-radius: var(--radius); padding: 28px 14px; cursor: pointer; background: #fafbfd; }
.drop.over { border-color: var(--primary); background: var(--blue-bg); }
.drop span { color: var(--muted); font-size: .9rem; }
#picked { margin-top: 10px; }
.bar { height: 12px; background: var(--grey-bg); border-radius: 99px; overflow: hidden; margin: 10px 0 14px; }
.bar-fill { height: 100%; background: var(--primary); transition: width .2s; }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sum { border-radius: 10px; padding: 10px; text-align: center; }
.sum b { display: block; font-size: 1.5rem; }
.sum span { font-size: .8rem; }
.sum-ok { background: var(--green-bg); color: #145c33; }
.sum-dup { background: var(--amber-bg); color: var(--amber); }
.sum-fail { background: var(--red-bg); color: #8e1f1f; }
.results { list-style: none; padding: 0; margin: 0; }
.results li { padding: 8px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; font-size: .9rem; }
.results li b { word-break: break-all; }
.results li span { color: var(--muted); }

/* Order list */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.batch-head { margin: 18px 0 8px; font-size: 1rem; color: var(--muted); }
.order { display: flex; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; margin-bottom: 10px; }
.order.hold { border: 2px solid var(--red); background: #fffafa; }
.order.cancelled { opacity: .55; }
.thumbs { display: flex; flex-direction: column; gap: 6px; flex: 0 0 72px; }
.thumbs a { position: relative; display: block; }
.thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; background: var(--grey-bg); display: block; }
.thumbs .count { position: absolute; right: 3px; bottom: 3px; background: rgba(0,0,0,.65); color: #fff; font-size: .7rem;
  padding: 1px 5px; border-radius: 6px; }
.noimg { width: 72px; height: 72px; display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: .7rem; color: var(--muted); background: var(--grey-bg); border-radius: 8px; }
.info { flex: 1; min-width: 0; }
.oid { font-weight: 700; font-size: 1rem; word-break: break-all; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ptitle { color: var(--muted); font-size: .9rem; }
.ctext { margin: 6px 0; padding: 6px 10px; background: var(--amber-bg); border-radius: 8px; font-weight: 600; word-break: break-word; }
.badges { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 99px; font-size: .75rem; font-weight: 600; background: var(--grey-bg); color: var(--ink); }
.badge-stage { background: var(--green-bg); color: #145c33; }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red); color: #fff; }
.badge-grey { background: var(--grey-bg); color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .85rem; }
.meta .red { font-weight: 700; }
.cust { margin-top: 8px; font-size: .85rem; }
.cust summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.cust ul { padding-left: 16px; margin: 6px 0 0; }
.cust li { margin-bottom: 3px; word-break: break-word; }
.cust .tag { font-style: normal; font-size: .7rem; background: var(--grey-bg); padding: 1px 6px; border-radius: 6px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 16px; }

/* Users & settings */
.user-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.user-row.disabled, .setting-row.disabled { opacity: .55; }
.checks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.check { display: flex; gap: 8px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.check input { width: 20px; height: 20px; }
.setting-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line); }

@media (min-width: 720px) {
  h1 { font-size: 1.6rem; }
  .thumbs { flex-direction: row; flex-basis: auto; }
  .thumbs img, .noimg { width: 96px; height: 96px; }
}

/* ===== Phase 2: team screens ===== */
.green { color: var(--green); }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 0 12px; padding-bottom: 2px; }
.tabs a { white-space: nowrap; padding: 8px 12px; border-radius: 99px; background: #fff; border: 1px solid var(--line); color: var(--ink); font-size: .9rem; }
.tabs a b { margin-left: 4px; color: var(--muted); }
.tabs a.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.tabs a.on b { color: #cdd6ea; }
.tabs a.tab-red { border-color: var(--red); color: var(--red); }
.tabs a.tab-red.on { background: var(--red); color: #fff; }
.section-head { margin: 18px 0 8px; font-size: 1rem; }
.empty-line { margin: 4px 0 10px; }
.paste summary { cursor: pointer; }
.paste textarea { margin-top: 10px; font-family: ui-monospace, Menlo, monospace; font-size: .9rem; }
.paste p { margin: 8px 0 0; word-break: break-word; }

.order.late:not(.hold) { border-left: 4px solid var(--red); }
.order.leaving { opacity: 0; transform: translateX(30px); transition: all .25s; }
.order.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.oid .sel { width: 22px; height: 22px; flex: 0 0 auto; margin: 0 2px 0 0; }
.qty-big { color: #fff; background: var(--red); padding: 0 7px; border-radius: 6px; }
.holdbox { margin: 6px 0; padding: 8px 10px; background: var(--red); color: #fff; border-radius: 8px; font-size: .9rem; }
.dstatus { border: 1px solid #d6c8f5; background: var(--purple-bg); color: var(--purple); font: inherit; font-size: .78rem;
  font-weight: 600; border-radius: 99px; padding: 3px 6px; max-width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.actions .btn { min-height: 44px; }
.actions .btn-next { background: var(--green); border-color: var(--green); color: #fff; flex: 1 1 140px; }
.actions .btn-next:disabled { background: #9cc9ad; border-color: #9cc9ad; }
.actions .btn-problem, .actions .btn-clear { color: var(--red); border-color: #f0b8b8; }
.btn-wa { background: #25d366; border-color: #25d366; color: #fff; }
.btn-wa:hover { background: #1fb457; }
.btn-danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.checklist { margin-top: 8px; padding: 8px; border: 1px dashed var(--amber); background: var(--amber-bg); border-radius: 10px; }
.checklist .check { background: #fff; margin-top: 6px; font-weight: 600; }
.checklist .check.done { color: var(--green); text-decoration: line-through; }

.bulkbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; gap: 8px; align-items: center;
  justify-content: space-between; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--brand); color: #fff;
  box-shadow: 0 -4px 16px rgba(0,0,0,.15); }
.bulkbar .btn { min-height: 44px; }
.toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%) translateY(20px); opacity: 0; z-index: 30;
  background: #1d2433; color: #fff; padding: 10px 16px; border-radius: 10px; max-width: 92vw; transition: all .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--red); }

.dlg { border: 0; border-radius: 16px; padding: 18px; width: min(440px, 94vw); max-height: 90vh; }
.dlg::backdrop { background: rgba(15, 20, 35, .55); }
.dlg h2 { margin-bottom: 4px; }
.dlg hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0 4px; }
.reasons { display: grid; gap: 6px; margin-top: 10px; }
.reasons .check input { width: 20px; height: 20px; }
.dlg-err { min-height: 1.2em; margin-top: 6px; }

/* ===== Phase 3: dashboard, search, detail ===== */
.search { width: 100%; order: 3; }
.search input { width: 100%; min-height: 40px; border-radius: 10px; border: 0; padding: 8px 12px; font: inherit; font-size: .95rem;
  background: rgba(255,255,255,.12); color: #fff; }
.search input::placeholder { color: #b7c0d6; }
.search input:focus { background: #fff; color: var(--ink); outline: none; }
.more-filters { grid-column: 1 / -1; }
.more-filters summary { cursor: pointer; color: var(--primary); font-weight: 600; font-size: .9rem; padding: 4px 0; }
.more-filters .filters { margin: 8px 0 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 12px; }
.tiles-dash { margin: 0 0 14px; }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 12px 6px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); min-height: 74px; }
.tile b { font-size: 1.5rem; line-height: 1.1; }
.tile span { font-size: .75rem; color: var(--muted); }
.tile.on { outline: 2px solid var(--primary); }
.tile.zero { opacity: .55; }
.tile-red:not(.zero) { background: var(--red-bg); border-color: #f3c2c2; }
.tile-red:not(.zero) b { color: var(--red); }
.tile-green:not(.zero) b { color: var(--green); }

.sbar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--grey-bg); margin-top: 8px; }
.sbar span { display: block; height: 100%; }
.seg-1 { background: #c3cad8; } .seg-2 { background: #a98ae6; } .seg-3 { background: #6f9cf4; }
.seg-4 { background: #f0b24a; } .seg-5 { background: #4fc282; } .seg-6 { background: #1f8f4e; } .seg-x { background: #e2e4ea; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0 0 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.batch-card { display: block; color: var(--ink); margin-bottom: 10px; }
.batch-card:hover { border-color: var(--primary); }
.batch-card.complete { opacity: .7; }

.alert-card { border: 2px solid var(--red); }
.alert-group + .alert-group { margin-top: 14px; }
.alert-list { list-style: none; padding: 0; margin: 6px 0 0; }
.alert-list li { display: flex; flex-wrap: wrap; gap: 2px 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: .88rem; }
.alert-list li a { font-weight: 700; }

.table-card { padding: 6px 10px; overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; font-size: .75rem; color: var(--muted); font-weight: 600; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }

.bulkbar { flex-direction: column; align-items: stretch; }
.bulk-row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.input-dark { min-height: 44px; flex: 1; }

.order.detail { display: block; }
.oid-big { margin: 0; font-size: 1.3rem; word-break: break-all; }
.oid-link { color: inherit; }
.oid-link:hover { color: var(--primary); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gimg { margin: 0; }
.gimg img { width: 100%; aspect-ratio: 3 / 4; object-fit: contain; background: var(--grey-bg); border-radius: 10px; display: block; }
.gimg-customer { grid-column: span 2; }
.gimg-customer img { aspect-ratio: auto; max-height: 520px; }
.gimg figcaption { font-size: .78rem; color: var(--muted); margin-top: 4px; word-break: break-all; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 10px 12px; margin: 0; }
.kv dt { color: var(--muted); font-size: .85rem; padding-top: 3px; }
.kv dd { margin: 0; word-break: break-word; }
.kv .ctext { display: inline-block; margin: 0; }
.input-date { width: auto; }
.inline-check { display: inline-flex; margin: 0 6px 6px 0; }
.plain { margin: 0; padding-left: 18px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 14px 8px; }
.timeline li::before { content: ''; position: absolute; left: -23px; top: 5px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary); border: 2px solid #fff; }
.timeline .tl-hold::before { background: var(--red); }
.timeline .tl-unhold::before, .timeline .tl-checklist::before { background: var(--green); }
.timeline .tl-cancel::before { background: var(--muted); }
.tl-head { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: .92rem; }
.tl-reason { font-size: .88rem; background: var(--grey-bg); padding: 4px 8px; border-radius: 8px; margin: 3px 0; display: inline-block; }

@media (min-width: 720px) {
  .search { order: 0; width: 320px; }
  .kv { grid-template-columns: 160px 1fr; }
}
@media (max-width: 719px) { .topbar { position: static; } }
.wrap-code { display: inline-block; word-break: break-all; margin-top: 4px; }
.purged-note { background: var(--grey-bg); padding: 8px 12px; border-radius: 10px; font-size: .88rem; margin-bottom: 10px; }
