:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2330;
  --muted: #5d6778;
  --border: #dde1e7;
  --primary: #1f5eff;
  --primary-text: #ffffff;
  --ok: #137a3f;
  --ok-bg: #e6f5ec;
  --warn: #8a5a00;
  --warn-bg: #fff4d6;
  --err: #b42318;
  --err-bg: #fdecea;
  --info-bg: #eef3ff;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; margin: 0 0 .75rem; }
h2 { font-size: 1.15rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; background: #eef0f3; padding: .05em .3em; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }

.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem;
  padding: .7rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; color: var(--text); }
.nav { display: flex; flex-wrap: wrap; gap: .25rem; flex: 1; }
.nav a { padding: .35rem .7rem; border-radius: 8px; color: var(--muted); }
.nav a.active, .nav a:hover { background: var(--info-bg); color: var(--primary); text-decoration: none; }
.userbox { display: flex; align-items: center; gap: .75rem; font-size: .9rem; }
.userbox form { margin: 0; }

.container { max-width: 1180px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card.narrow { max-width: 460px; margin: 2rem auto; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 1rem; }
a.card { display: block; color: inherit; text-decoration: none; }
a.card:hover { border-color: var(--primary); }
.stat { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

label { display: flex; flex-direction: column; gap: .25rem; font-weight: 500; font-size: .9rem; }
label.inline { flex-direction: row; align-items: center; gap: .4rem; font-weight: 400; }
input, select, textarea {
  font: inherit; padding: .45rem .6rem; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); min-width: 0;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  font: inherit; font-weight: 600; padding: .5rem .95rem; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none;
}
button:hover, .button:hover { background: #f0f2f5; text-decoration: none; }
button.primary, .button.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
button.primary:hover, .button.primary:hover { filter: brightness(1.07); }
button.danger { color: var(--err); border-color: #f2c4bf; }
button.small { padding: .3rem .6rem; font-size: .85rem; }
button.link { border: 0; background: none; padding: 0; color: var(--primary); font-weight: 500; }
button:disabled { opacity: .5; cursor: not-allowed; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
tr.row-error td { background: var(--err-bg); }
tr.row-warning td { background: var(--warn-bg); }
tr.row-muted td { color: var(--muted); }

.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; background: #eef0f3; color: var(--muted); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); }
.badge.info { background: var(--info-bg); color: var(--primary); }

.alert { padding: .7rem .9rem; border-radius: 8px; margin: .75rem 0; border: 1px solid transparent; }
.alert.error { background: var(--err-bg); color: var(--err); border-color: #f2c4bf; }
.alert.warning { background: var(--warn-bg); color: var(--warn); border-color: #f1dca0; }
.alert.success { background: var(--ok-bg); color: var(--ok); border-color: #b9e2c8; }
.alert.info { background: var(--info-bg); color: #1f3d99; border-color: #cfdcff; }

ul.issues { margin: .25rem 0 0; padding-left: 1.1rem; }
ul.issues li { margin: .15rem 0; }
.sev-ERROR { color: var(--err); }
.sev-WARNING { color: var(--warn); }
details summary { cursor: pointer; }
.plan-form input[type="date"], .plan-form input[type="datetime-local"] { width: 100%; }

@media (max-width: 640px) {
  .container { padding: 1rem .75rem 2.5rem; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .grid .card { padding: .7rem .8rem; margin: 0; }
  .stat { font-size: 1.5rem; }
  .nav { order: 3; flex-basis: 100%; }
  h1 { font-size: 1.3rem; }
  .userbox { width: 100%; justify-content: space-between; }
  th, td { padding: .5rem .4rem; }
}

/* ───────────── Picking (mobile first) ───────────── */
body.pick { background: var(--bg); font-size: 17px; }
.pick-top {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .55rem 1rem; padding-top: max(.55rem, env(safe-area-inset-top));
  background: var(--surface); border-bottom: 1px solid var(--border); font-size: .95rem;
}
.pick-top form { display: inline; margin: 0; }
.pick-back { font-weight: 600; padding: .5rem 0; min-height: 44px; display: inline-flex; align-items: center; }
.pick-brand { font-weight: 700; }
.pick-user { color: var(--muted); display: inline-flex; gap: .5rem; align-items: center; }
.pick-main {
  max-width: 560px; margin: 0 auto; padding: .9rem 1rem 1rem;
  min-height: calc(100dvh - 56px); display: flex; flex-direction: column;
}
.pick-title { font-size: 1.5rem; margin: .2rem 0 .6rem; }
.pick-section { margin-bottom: 1.1rem; }
.pick-section h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: .4rem 0 .5rem; }
.pick-empty { color: var(--muted); font-size: 1.1rem; padding: 2rem 0; text-align: center; }

.work {
  display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: .9rem 1rem; margin-bottom: .65rem; color: var(--text); box-shadow: var(--shadow);
}
.work:hover { text-decoration: none; border-color: var(--primary); }
.work-mine { border: 2px solid var(--primary); }
.work-other { opacity: .75; }
.work-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.work-name { font-size: 1.3rem; font-weight: 700; }
.prio { font-size: .8rem; font-weight: 700; color: var(--err); text-transform: uppercase; letter-spacing: .04em; }
.work-meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; color: var(--muted); margin-top: .2rem; }
.work-foot { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-top: .45rem; }
.work-foot .st { flex: 1; min-width: 0; }
.work-cta { font-weight: 700; color: var(--primary); white-space: nowrap; }
.st { font-weight: 600; color: var(--muted); }
.st-mine { color: var(--primary); }
.st-other { color: var(--warn); }
.dl-soon { color: var(--warn); }
.dl-overdue { color: var(--err); }
.done-row { padding: .45rem 0; border-bottom: 1px solid var(--border); }

progress.bar { width: 100%; height: 8px; border: 0; border-radius: 99px; overflow: hidden; background: var(--border); appearance: none; margin: .35rem 0; }
progress.bar::-webkit-progress-bar { background: var(--border); border-radius: 99px; }
progress.bar::-webkit-progress-value { background: var(--ok); border-radius: 99px; }
progress.bar::-moz-progress-bar { background: var(--ok); border-radius: 99px; }

.pick-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.pick-loc { font-weight: 700; text-transform: uppercase; letter-spacing: .04em; font-size: .95rem; }
.pick-count { font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.pick-item { padding: 1.4rem 0 .5rem; }
.center { text-align: center; }
.pick-item.center { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 1.5rem .25rem; }
.pick-pos { color: var(--muted); margin: 0 0 .3rem; font-size: .9rem; }
.pick-product { font-size: 1.7rem; line-height: 1.25; font-weight: 700; margin: 0 0 .9rem; overflow-wrap: anywhere; letter-spacing: -.01em; }
.pick-product.small { font-size: 1.35rem; }
.pick-qty { font-size: 5.2rem; font-weight: 800; line-height: 1; margin: 0; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.pick-qty small { font-size: 1.5rem; font-weight: 600; color: var(--muted); margin-left: .35rem; letter-spacing: 0; }
.pick-state { display: inline-block; margin: 1rem auto 0; padding: .35rem .8rem; border-radius: 99px; font-weight: 700; font-size: .95rem; }
.pick-state.ok { background: var(--ok-bg); color: var(--ok); }
.pick-state.warn { background: var(--warn-bg); color: var(--warn); }
.pick-note { padding: .7rem .9rem; border-radius: 10px; font-weight: 600; margin: .6rem 0; }
.pick-note.ok { background: var(--ok-bg); color: var(--ok); }
.pick-note.warn { background: var(--warn-bg); color: var(--warn); }
.pick-links { display: flex; justify-content: space-between; padding: .1rem 0 0; }
.pick-links.single { justify-content: center; }
.pick-links a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 .5rem; font-weight: 600; color: var(--muted); font-size: .95rem; }
.pick-secondary { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.pick-secondary form { margin: 0; }
.pick-secondary .btn-secondary { min-height: 52px; font-size: 1rem; }
.pick-hint { text-align: center; color: var(--muted); font-size: .9rem; margin: .1rem 0; }
.pick-hint.left { text-align: left; }
.pick-kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; font-weight: 700; color: var(--muted); margin: 0 0 .3rem; }
.tag { font-size: .7rem; background: var(--warn-bg); color: var(--warn); padding: .1rem .45rem; border-radius: 99px; vertical-align: middle; letter-spacing: .02em; }
.today-head { display: flex; align-items: baseline; justify-content: space-between; }
.today-count { font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.receive-link { display: flex; align-items: center; justify-content: center; min-height: 48px; margin: 0 0 1rem; border: 1px dashed var(--border); border-radius: 12px; font-weight: 700; background: var(--surface); }
.receive-link:hover { text-decoration: none; border-color: var(--primary); }
.work-picked { border-left: 4px solid var(--primary); }
.st-picked { color: var(--primary); }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: 1.2rem 0 .8rem; }
.summary-grid > div { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .7rem .3rem; }
.summary-grid .is-short { background: var(--warn-bg); border-color: #f1dca0; }
.summary-num { display: block; font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.summary-label { display: block; font-size: .8rem; color: var(--muted); }
.summary-meta { margin: .4rem 0 1rem; }
.summary-meta > div { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--border); }
.summary-meta dt { color: var(--muted); }
.summary-meta dd { margin: 0; font-weight: 700; text-align: right; }
.summary-meta dd.note { font-weight: 500; white-space: pre-wrap; }
.pick-actions {
  position: sticky; bottom: 0; display: flex; flex-direction: column; gap: .6rem;
  padding: .6rem 0 max(.8rem, env(safe-area-inset-bottom)); background: var(--bg);
}
.pick-actions form { margin: 0; }
.btn-primary, .btn-secondary, .btn-toggle {
  display: flex; align-items: center; justify-content: center; width: 100%;
  font: inherit; font-weight: 800; border-radius: 14px; cursor: pointer; text-decoration: none;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.btn-primary { min-height: 68px; font-size: 1.3rem; background: var(--ok); color: #fff; border: 0; }
.btn-primary:disabled { background: #9aa3af; opacity: 1; }
.btn-secondary { min-height: 56px; font-size: 1.05rem; background: var(--surface); color: var(--text); border: 1px solid var(--border); font-weight: 700; }
.btn-toggle { min-height: 60px; font-size: 1.1rem; background: var(--surface); border: 2px dashed var(--warn); color: var(--text); }
a.btn-primary:hover, a.btn-secondary:hover { text-decoration: none; }

.pick-label { font-size: 1.15rem; font-weight: 700; margin: .8rem 0 .5rem; display: block; }
.pick-qtyform { display: flex; flex-direction: column; flex: 1; }
.stepper { display: grid; grid-template-columns: 76px 1fr 76px; gap: .6rem; align-items: stretch; margin-bottom: 1rem; }
.stepper .step { min-height: 76px; font-size: 2.2rem; font-weight: 700; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); touch-action: manipulation; }
.stepper input { text-align: center; font-size: 2.6rem; font-weight: 800; border-radius: 14px; min-height: 76px; width: 100%; font-variant-numeric: tabular-nums; }
.pick-qtyform .pick-actions { margin-top: auto; }

.pick-legend { font-size: .85rem; margin: .2rem 0 .4rem; }
.list { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.li { display: grid; grid-template-columns: 1.6rem 1fr auto; gap: .5rem; align-items: center; padding: .7rem .8rem; min-height: 52px; border-bottom: 1px solid var(--border); color: var(--text); }
.li:last-child { border-bottom: 0; }
.li:hover { text-decoration: none; background: #f7f8fa; }
.li-sym { font-size: 1.15rem; text-align: center; }
.li-name { overflow-wrap: anywhere; }
.li-val { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.li-ok .li-sym { color: var(--ok); }
.li-short { background: var(--warn-bg); }
.li-short .li-sym, .li-short .li-val { color: var(--warn); }
.li-pending .li-val { color: var(--muted); font-weight: 500; }

.pick-hero { padding: 1.5rem 0 1rem; }
.pick-hero.compact { padding: .6rem 0 .4rem; }
.pick-kiosk { font-size: 2rem; margin: 0 0 .3rem; }
.pick-big { font-size: 1.3rem; font-weight: 700; margin: .2rem 0; }
.pick-done { font-size: 1.9rem; font-weight: 800; color: var(--ok); margin: .2rem 0 .4rem; }
.review-counts { display: flex; justify-content: center; gap: 1.2rem; font-weight: 600; margin: .3rem 0 .8rem; }
.pick-hero + .pick-actions, .pick-hero ~ .pick-actions { margin-top: auto; }
.pick-status { position: sticky; bottom: 0; background: var(--err-bg); color: var(--err); border: 1px solid #f2c4bf; border-radius: 12px; padding: .8rem; margin-top: .6rem; font-weight: 600; }
.pick-status p { margin: 0 0 .5rem; }

@media (max-width: 360px) {
  .pick-product { font-size: 1.5rem; }
  .pick-qty { font-size: 3.6rem; }
  .stepper { grid-template-columns: 64px 1fr 64px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .pick-main { min-height: auto; }
  .pick-item { padding: .6rem 0 .2rem; }
  .pick-qty { font-size: 3rem; }
  .pick-actions { position: static; flex-direction: row; }
  .pick-actions > form { flex: 2; }
  .pick-actions > .btn-secondary, .pick-actions > .pick-secondary { flex: 1.4; }
  .pick-actions > .pick-links { flex-basis: 100%; }
  .pick-actions { flex-wrap: wrap; }
  .pick-qty { font-size: 3.4rem; }
  .pick-item.center { padding: .4rem 0; }
  .btn-primary { min-height: 56px; }
}

/* goods receipt (mobile) */
.receipt-form { display: flex; flex-direction: column; gap: 1rem; flex: 1; }
.receipt-form .field { font-weight: 700; font-size: 1rem; display: flex; flex-direction: column; gap: .4rem; border: 0; padding: 0; margin: 0; }
.receipt-form legend { font-weight: 700; margin-bottom: .4rem; padding: 0; }
.receipt-form select, .receipt-form input[type="text"], .receipt-form input:not([type]), .receipt-form textarea { font-size: 1.05rem; min-height: 52px; border-radius: 12px; padding: .6rem .8rem; font-weight: 500; }
.receipt-form [hidden] { display: none; }
.upload-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.upload-btn { position: relative; overflow: hidden; min-height: 56px; }
.upload-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.attach-list { list-style: none; margin: .2rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.attach-item { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: .6rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .4rem .5rem; font-weight: 500; }
.attach-item img, .attach-icon { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: #eef0f3; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 800; color: var(--muted); }
.attach-name { overflow-wrap: anywhere; font-size: .9rem; }
.attach-remove { border: 0; background: none; color: var(--err); font-weight: 700; min-height: 44px; padding: 0 .5rem; }
.attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; margin: .6rem 0 1rem; }
.attach-thumb, .attach-file { display: flex; flex-direction: column; gap: .3rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .4rem; color: var(--text); font-size: .8rem; overflow-wrap: anywhere; }
.attach-thumb img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; background: #eef0f3; }
.attach-file .attach-icon { width: 100%; height: auto; aspect-ratio: 3 / 4; font-size: 1.2rem; }
.note-box { background: var(--warn-bg); border-radius: 10px; padding: .7rem .9rem; white-space: pre-wrap; }

/* admin live */
.live-status { margin: .3rem 0 0; }
.live-status.live-bad { color: var(--err); font-weight: 600; }
progress.bar.mini { width: 80px; height: 6px; margin: 0 .4rem 0 0; vertical-align: middle; }
.filter { margin-bottom: 1rem; }
.stats .card { margin-bottom: 0; }

/* multi-picker */
.pick-direction { margin: .35rem 0 0; font-size: .85rem; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.pick-note.info { background: var(--info-bg); color: #1f3d99; }
.pick-status.info { background: var(--info-bg); color: #1f3d99; border-color: #cfdcff; }
.li-claimed { background: var(--info-bg); }
.li-claimed .li-sym, .li-claimed .li-val { color: #1f3d99; }
.picker-line { display: block; font-size: .85rem; white-space: nowrap; }

/* branding: "MyAIHub Ops", "OPS" on very small screens */
.brand-short { display: none; }
@media (max-width: 340px) {
  .brand-full { display: none; }
  .brand-short { display: inline; }
}

/* login */
.login-card { text-align: left; }
.login-brand { text-align: center; font-size: 1.5rem; letter-spacing: .02em; margin-bottom: 1rem; }
.login-google { width: 100%; min-height: 48px; }
.login-divider { display: flex; align-items: center; gap: .75rem; color: var(--muted); margin: 1rem 0; font-size: .9rem; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.login-form h2 { font-size: 1.05rem; margin: 0; }
.login-form input { min-height: 48px; font-size: 1.05rem; }
.login-form button { min-height: 48px; }
