/* House of Cameras — light theme, matching the HOC Inventory and Listing apps.
   All assets local: works in mainland China. */
@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
:root {
  /* brand */
  --brand: #0E3E40; --brand-pressed: #0a2e2f; --brand-light: #14585b;
  --tint: #E8F4F3;            /* active / selected background */
  --accent: #3bc4bf;          /* fills and highlights only — never text on white */
  /* surfaces */
  --bg: #FFFFFF; --panel: #FFFFFF; --group: #F4F5F7; --panel-2: #F4F5F7; --panel-3: #EEF0F3;
  /* text */
  --text: #0F172A; --muted: #6B7280; --faint: #9CA3AF;
  /* lines */
  --line: #E9EBEF; --line-2: #DFE2E7;
  /* status */
  --green: #15803D; --green-bg: #F0FDF4; --green-line: #BBF7D0;
  --amber: #B45309; --amber-bg: #FFFBEB; --amber-line: #FDE68A;
  --red: #B91C1C;   --red-bg: #FEF2F2;   --red-line: #FECACA;
  --radius: 16px; --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(15,23,42,.04);
  --float: 0 2px 12px rgba(15,23,42,.10);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'HarmonyOS Sans SC', 'MiSans', 'Microsoft YaHei', 'Noto Sans CJK SC', 'Source Han Sans SC', sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--group); color: var(--text); font: 15px/1.45 var(--font); -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body.zh { font-size: 16px; }
a { color: var(--brand); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 40px; color: var(--muted); }
.hidden { display: none !important; }

/* top bar: white, hairline border, soft shadow (as the Listing tool) */
.top { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.96); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--line); box-shadow: 0 1px 8px rgba(15,23,42,.04); }
.top-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 14px; padding: 10px 16px; }
.logo { width: 36px; height: 36px; border-radius: 8px; flex: none; object-fit: contain; }
.app-title { font-weight: 700; font-size: 17px; white-space: nowrap; letter-spacing: -.01em; }
.nav { display: flex; gap: 2px; overflow-x: auto; flex: 1; min-width: 0; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
@media (max-width: 600px) { body.admin .app-title, body.admin .user-menu { display: none; } .top-inner { gap: 8px; padding: 8px 10px; } }
.nav a { color: var(--muted); padding: 8px 12px; border-radius: 999px; white-space: nowrap; font-weight: 500; position: relative; min-height: 38px; display: inline-flex; align-items: center; }
.nav a:hover { color: var(--text); background: var(--group); text-decoration: none; }
.nav a.active { background: var(--tint); color: var(--brand); font-weight: 600; }
.nav .badge { position: absolute; top: 0; right: -2px; }
.user-menu { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
.user-menu a { color: var(--muted); }

main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 110px; }
h1 { font-size: 24px; margin: 4px 0 16px; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; margin: 24px 0 10px; }
body.zh h2 { text-transform: none; letter-spacing: 0; font-size: 14px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .grid2 { grid-template-columns: 1fr; } }
.grid2 > * { min-width: 0; }
input[type=file] { max-width: 100%; font-size: 13px; color: var(--muted); }

/* cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 12px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 12px; }
.kv > div:nth-child(odd) { color: var(--muted); font-size: 13px; padding-top: 1px; }
body.zh .kv { grid-template-columns: 110px 1fr; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-2); background: #fff; color: var(--text); border-radius: 12px; padding: 9px 16px; cursor: pointer; font-weight: 600; min-height: 44px; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--group); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14,62,64,.14); }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-light); border-color: var(--brand-light); }
.btn.primary:active { background: var(--brand-pressed); }
.btn.good { background: var(--green); border-color: var(--green); color: #fff; }
.btn.good:hover { background: #166534; }
.btn.bad { background: #fff; border-color: var(--red-line); color: var(--red); }
.btn.bad:hover { background: var(--red-bg); }
.btn.bad.big, .two-btns .btn.bad { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn.ghost:hover { background: var(--tint); }
.btn.small { min-height: 34px; padding: 5px 12px; font-size: 13px; border-radius: 10px; }
.btn.big { min-height: 64px; font-size: 19px; padding: 14px 18px; width: 100%; border-radius: var(--radius); }
.btn[disabled] { opacity: .45; cursor: default; }

/* forms */
label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 5px; }
input[type=text], input[type=password], input[type=number], input[type=datetime-local], input[type=search], input[type=time], select, textarea {
  width: 100%; background: var(--group); border: 1px solid transparent; border-radius: 12px; padding: 10px 12px; min-height: 44px;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: var(--line-2); }
textarea { min-height: 84px; resize: vertical; }
.check { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
input[type=checkbox] { accent-color: var(--brand); width: 18px; height: 18px; }

/* pills */
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: .3px; text-transform: uppercase; border: 1px solid; white-space: nowrap; }
body.zh .pill { text-transform: none; font-size: 12px; letter-spacing: 0; }
.pill.red { color: var(--red); background: var(--red-bg); border-color: var(--red-line); }
.pill.amber { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-line); }
.pill.green { color: var(--green); background: var(--green-bg); border-color: var(--green-line); }
.pill.teal { color: var(--brand); background: var(--tint); border-color: #CFE7E5; }
.pill.grey { color: var(--muted); background: var(--group); border-color: var(--line); }
.badge { background: var(--red); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 0 6px; min-width: 18px; text-align: center; line-height: 18px; display: inline-block; }

/* banners */
.banner { border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 12px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; border: 1px solid; }
.banner.warn { background: var(--amber-bg); border-color: var(--amber-line); color: #78350F; }
.banner.bad { background: var(--red-bg); border-color: var(--red-line); color: #7F1D1D; }
.banner.info { background: var(--tint); border-color: #CFE7E5; color: var(--brand); }
.banner .btn { margin-left: auto; }

/* metric tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
.tile:hover { border-color: #CFE7E5; box-shadow: var(--float); }
.tile .n { font-size: 28px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.tile .l { font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 500; }

/* item rows: one grouped white list, hairline separators (Sortly style) */
.items { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.item-row { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; background: var(--panel); padding: 12px 14px; cursor: pointer; border-bottom: 1px solid var(--line); position: relative; transition: background .12s; }
.item-row:last-child { border-bottom: 0; }
.item-row:hover { background: #FAFBFC; }
.item-row.red::before, .item-row.amber::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; }
.item-row.red::before { background: var(--red); }
.item-row.amber::before { background: #F59E0B; }
.thumb { width: 64px; height: 64px; border-radius: var(--radius-sm); object-fit: cover; background: var(--group); }
.item-row .t1 { font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.item-row .t2 { font-size: 13px; color: var(--muted); margin-top: 2px; }
.item-row .right { text-align: right; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.alert-line { font-size: 13px; margin-top: 4px; font-weight: 500; }
.alert-line.red { color: var(--red); }
.alert-line.amber { color: var(--amber); }
@media (max-width: 600px) {
  .item-row { grid-template-columns: 56px 1fr; }
  .thumb { width: 56px; height: 56px; }
  .item-row .right { grid-column: 1 / -1; flex-direction: row; justify-content: flex-start; flex-wrap: wrap; }
}

/* filter chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 500; cursor: pointer; min-height: 34px; }
.chip:hover { background: var(--group); }
.chip.active { background: var(--tint); border-color: #CFE7E5; color: var(--brand); font-weight: 600; }

/* item detail */
.detail-photo { width: 100%; max-height: 420px; object-fit: contain; background: var(--group); border-radius: var(--radius-sm); cursor: zoom-in; }
.gallery { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.gallery img { width: 84px; height: 84px; object-fit: cover; border-radius: var(--radius-sm); cursor: zoom-in; border: 1px solid var(--line); }
.big-title { font-size: 20px; font-weight: 700; line-height: 1.35; letter-spacing: -.01em; }
body.zh .big-title { font-size: 22px; }
.sub-title { color: var(--muted); margin-top: 4px; }
.action-box { border: 1px solid #CFE7E5; background: var(--tint); border-radius: var(--radius); padding: 18px; margin-top: 12px; }
.action-box h3 { margin: 0 0 12px; font-size: 18px; color: var(--brand); }
.two-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.done-line { display: flex; gap: 8px; align-items: center; padding: 8px 0; color: var(--green); font-weight: 600; }
.done-line.bad { color: var(--red); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; display: flex; gap: 10px; }
.timeline li:last-child { border-bottom: 0; }
.timeline li .when { color: var(--muted); white-space: nowrap; min-width: 120px; }

/* forwarder home */
.scan-cta { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }

/* scanner */
.scanner { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 3 / 4; max-height: 60vh; width: 100%; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner .frame { position: absolute; inset: 30% 10%; border: 2px solid var(--accent); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }

/* lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(15,23,42,.92); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 12px; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* modal (bottom sheet on phones, dialog on desktop) */
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 90; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 700px) { .modal-bg { align-items: center; } }
.modal { background: #fff; border-radius: 20px 20px 0 0; width: 100%; max-width: 520px; padding: 20px; max-height: 90vh; overflow: auto; box-shadow: 0 -4px 24px rgba(15,23,42,.12); padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .modal { border-radius: 20px; box-shadow: 0 10px 40px rgba(15,23,42,.18); } }
.modal h3 { margin: 0 0 14px; font-size: 18px; }

/* toast */
#toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 16px; border-radius: 12px; box-shadow: var(--float); z-index: 200; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; font-weight: 500; }
#toast.show { opacity: 1; }
#toast.bad { background: var(--red); }

/* login */
.login { max-width: 380px; margin: 10vh auto; }
.login .logo { width: 72px; height: 72px; margin: 0 auto 16px; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
.log { max-height: 320px; overflow: auto; background: var(--group); border-radius: var(--radius-sm); padding: 10px; font-size: 12px; }
.log div { padding: 2px 0; }
.log .warn { color: var(--amber); }
.log .error { color: var(--red); }

/* floating bottom tab bar on phones (forwarder), as the Inventory app */
.bottom-nav { position: fixed; bottom: calc(12px + env(safe-area-inset-bottom)); left: 12px; right: 12px; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--float); display: none; z-index: 30; padding: 4px; }
.bottom-nav a { flex: 1; text-align: center; padding: 8px 4px; color: var(--muted); font-size: 12px; font-weight: 500; position: relative; border-radius: 16px; min-height: 52px; text-decoration: none; }
.bottom-nav a.active { color: var(--brand); background: var(--tint); font-weight: 600; }
.bottom-nav .ico { font-size: 20px; display: block; line-height: 1.2; }
.bottom-nav .badge { position: absolute; top: 4px; right: 18%; }
@media (max-width: 700px) {
  body.fwd .bottom-nav { display: flex; }
  body.fwd .top .nav { display: none; }
}
input[type=file]::file-selector-button { font: inherit; font-weight: 600; color: var(--brand); background: #fff; border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 12px; margin-right: 10px; cursor: pointer; }
input[type=file]::file-selector-button:hover { background: var(--tint); }

/* pick several items: tick boxes + floating action bar */
.pick-bar-top { margin-bottom: 8px; }
.item-row.pick { grid-template-columns: 26px 64px 1fr; cursor: pointer; }
.item-row.pick input[type=checkbox] { width: 22px; height: 22px; margin: 0; }
.item-row.pick.on { background: var(--tint); }
@media (max-width: 600px) { .item-row.pick { grid-template-columns: 26px 56px 1fr; } }
.pick-bar { position: sticky; bottom: 12px; margin-top: 12px; z-index: 25; display: none; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--float); padding: 8px 8px 8px 16px; font-weight: 600; }
.pick-bar.show { display: flex; }
@media (max-width: 700px) { body.fwd .pick-bar { bottom: calc(92px + env(safe-area-inset-bottom)); } }

/* pipeline board */
.board { display: grid; grid-template-columns: repeat(6, minmax(200px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
@media (max-width: 900px) { .board { grid-template-columns: 1fr; overflow: visible; } }
.col { background: var(--group); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-width: 0; }
.col header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 2px 4px 10px; }
.col h3 { margin: 0; font-size: 14px; font-weight: 700; }
.col .count { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.col-body { display: flex; flex-direction: column; gap: 8px; max-height: 70vh; overflow-y: auto; }
@media (max-width: 900px) { .col-body { max-height: none; } }
.mini { display: flex; gap: 10px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; cursor: pointer; }
.mini:hover { border-color: #CFE7E5; box-shadow: var(--float); }
.mini .thumb { width: 44px; height: 44px; border-radius: 10px; flex: none; }
.mini-body { flex: 1; min-width: 0; }
.mini-t { font-size: 13px; font-weight: 600; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mini-s { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-thumbs { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; align-items: center; }
.mini-thumbs .thumb { width: 28px; height: 28px; border-radius: 6px; }
.mini-thumbs .more { font-size: 11px; color: var(--muted); font-weight: 600; }
.mini .pill { flex: none; }
.modal button.item-row { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; color: inherit; }
.modal button.item-row:last-child { border-bottom: 0; }
main.wide { max-width: 1680px; }
