:root {
  --bg: #f4f5f7;
  --surface: #fff;
  --text: #1d2430;
  --muted: #667085;
  --line: #e2e5ea;
  --primary: #f5a700;
  --primary-ink: #1d2430;
  --accent: #1f3a5f;
  --danger: #c4320a;
  --ok-bg: #e9f7ef;
  --ok-ink: #146c43;
  --err-bg: #fdecea;
  --err-ink: #9b1c1c;
  --radius: 10px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; font-size: 16px; }
a { color: var(--accent); }
h1 { font-size: 1.35rem; margin: .5rem 0 1rem; }
h2 { font-size: 1.1rem; }
input, select, textarea, button { font: inherit; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=date], input[type=month], input:not([type]), select, textarea {
  width: 100%; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
code { background: #eef0f3; padding: 0 .3em; border-radius: 4px; }

.container { max-width: 960px; margin: 0 auto; padding: 1rem 16px 4rem; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: .6rem 16px; background: var(--accent); color: #fff; }
.topbar a, .topbar .linklike { color: #fff; text-decoration: none; font-size: .9rem; }
.brand { font-weight: 700; font-size: 1rem !important; }
.topbar-right { display: flex; gap: 1rem; align-items: center; }
.topbar-right form { margin: 0; }
.linklike { background: none; border: 0; padding: 0; cursor: pointer; }
.tabs { display: flex; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; position: sticky; top: 0; z-index: 10; }
.tabs a { flex: 1; min-width: 4.5rem; text-align: center; padding: .7rem .5rem; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--text); border-bottom-color: var(--primary); }
.count { display: inline-block; margin-left: .25rem; background: var(--danger); color: #fff; border-radius: 999px; font-size: .75rem; padding: 0 .45rem; }

.btn { display: inline-block; padding: .6rem 1rem; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); text-decoration: none; cursor: pointer; font-weight: 600; text-align: center; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn-sm { padding: .35rem .7rem; font-size: .9rem; }
.btn-lg { padding: .85rem 1.2rem; font-size: 1.05rem; }
.btn-block { display: block; width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 1rem 0; }
.actions form { margin: 0; }
.actions.stack { flex-direction: column; align-items: stretch; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.card.link { display: block; color: inherit; text-decoration: none; }
.card.link:hover { border-color: var(--primary); }
.card.attention { border-left: 4px solid var(--danger); }
.card-title { margin: 0 0 .75rem; font-size: 1.05rem; }
.cards { display: grid; gap: .75rem; }
.cards .card { margin: 0; }
.archived { opacity: .55; }

.form label { display: block; margin-bottom: .8rem; font-size: .9rem; color: var(--muted); }
.form label input, .form label select, .form label textarea { margin-top: .25rem; color: var(--text); }
.form label.check { display: flex; gap: .5rem; align-items: flex-start; color: var(--text); }
.form label.check input { width: auto; margin-top: .35rem; }
.form fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 1rem; padding: .75rem; }
.form legend { font-weight: 700; padding: 0 .3rem; }
.row2, .row3 { display: grid; gap: .75rem; grid-template-columns: 1fr 1fr; }
.row3 { grid-template-columns: 1fr 1fr 1fr; }
.req { color: var(--danger); font-size: .75rem; }

.flash { padding: .75rem 1rem; border-radius: 8px; margin: 0 0 1rem; }
.flash-ok { background: var(--ok-bg); color: var(--ok-ink); }
.flash-error { background: var(--err-bg); color: var(--err-ink); }
.plain .flash { max-width: 480px; margin: 1rem auto; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.num { text-align: right; white-space: nowrap; }
.big { font-size: 1.15rem; font-weight: 700; }
.row-between { display: flex; justify-content: space-between; gap: .5rem; align-items: center; }

.searchbar { display: flex; gap: .5rem; margin-bottom: 1rem; }
.searchbar input { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { padding: .35rem .8rem; border-radius: 999px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--text); }

.product { display: flex; justify-content: space-between; gap: .75rem; }
.product-name { font-weight: 700; }
.product-spec, .product-store { font-size: .85rem; color: var(--muted); }
.product-side { text-align: right; min-width: 8.5rem; }
.price { font-size: 1.2rem; font-weight: 700; }
.price small { font-size: .75rem; font-weight: 400; color: var(--muted); }
.stock { font-size: .8rem; font-weight: 600; }
.stock-in_stock { color: var(--ok-ink); }
.stock-low { color: #b54708; }
.stock-out { color: var(--danger); }
.addcart { display: flex; gap: .35rem; justify-content: flex-end; margin-top: .4rem; }
.addcart input { width: 4.2rem; padding: .35rem; }

.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: .5rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.table th { color: var(--muted); font-weight: 600; font-size: .8rem; white-space: nowrap; }
.table td.num, .table th.num { text-align: right; }
.table tr.sum td { font-weight: 700; border-top: 2px solid var(--text); }
.table .qty input { width: 4.5rem; }
.scroll-x { overflow-x: auto; }
.est-table select { min-width: 12rem; }
.est-table td:first-child { min-width: 11rem; }
.w-qty { width: 5.5rem !important; }
.w-factor { width: 4.5rem !important; }

.plainlist { list-style: none; padding: 0; margin: 0; }
.plainlist li { display: flex; justify-content: space-between; gap: .5rem; padding: .35rem 0; border-bottom: 1px dashed var(--line); }
.total { font-size: 1.1rem; text-align: right; }
.total strong { font-size: 1.4rem; }
.demo-box { background: #fff8e6; border: 1px dashed var(--primary); border-radius: 8px; padding: .6rem .8rem; font-size: .9rem; margin-bottom: .8rem; }
.demo-note { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem; }

.badge { display: inline-block; font-size: .75rem; padding: .15rem .55rem; border-radius: 999px; background: #eef0f3; color: var(--text); white-space: nowrap; }
.badge-pending { background: #fff4e5; color: #b54708; }
.badge-confirmed, .badge-ready { background: #e8f1fb; color: var(--accent); }
.badge-delivering { background: #ede9fe; color: #5b21b6; }
.badge-delivered { background: var(--ok-bg); color: var(--ok-ink); }
.badge-rejected, .badge-cancelled { background: var(--err-bg); color: var(--err-ink); }

.steps { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; gap: .25rem; font-size: .75rem; }
.steps li { flex: 1; text-align: center; padding: .4rem .2rem; background: #e5e7eb; color: var(--muted); border-radius: 6px; }
.steps li.done { background: var(--primary); color: var(--primary-ink); font-weight: 700; }
.dl { display: grid; grid-template-columns: 6rem 1fr; gap: .4rem .75rem; margin: 0; }
.dl dt { color: var(--muted); font-size: .85rem; }
.dl dd { margin: 0; }

.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.summary div { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; }
.summary span { display: block; font-size: .8rem; color: var(--muted); }
.summary strong { font-size: 1.25rem; }
.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-bottom: 1rem; }
.filters label { font-size: .85rem; color: var(--muted); }
.seg { display: flex; gap: .25rem; margin-bottom: 1rem; }
.seg a { padding: .4rem .9rem; border-radius: 999px; text-decoration: none; color: var(--muted); border: 1px solid var(--line); background: #fff; }
.seg a.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.result-row { display: flex; gap: .5rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.result-row .grow { flex: 1; min-width: 12rem; }
details { margin-top: 1rem; }
summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.danger-zone { margin-top: 1rem; text-align: right; }
form.inline { display: flex; gap: .35rem; }
form.inline select { width: auto; }
pre.code { background: #1d2430; color: #e5e7eb; padding: .8rem; border-radius: 8px; overflow-x: auto; font-size: .8rem; }

/* auth & plain pages */
.center-card { max-width: 480px; margin: 2rem auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem 1.25rem; }
.center-card h1 { font-size: 1.2rem; }
.center-card h2 { font-size: 1rem; color: var(--muted); }
@media (max-width: 520px) { .center-card { margin: 1rem 16px; } }

/* landing */
.lp-inner { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.lp-hero { background: var(--accent); color: #fff; padding: 3.5rem 0 3rem; }
.lp-kicker { color: var(--primary); font-weight: 700; margin: 0; }
.lp-hero h1 { font-size: 2.4rem; line-height: 1.25; margin: .5rem 0 1rem; }
.lp-lead { max-width: 36rem; opacity: .92; }
.lp-cta { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.lp-login a { color: #fff; }
.lp-section { padding: 2.5rem 0; }
.lp-alt { background: #fff; }
.lp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.lp-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.lp-alt .lp-card { background: var(--bg); }
.lp-card h3 { margin: 0 0 .4rem; font-size: 1rem; }
.lp-card p { margin: 0; font-size: .92rem; color: var(--muted); }
.lp-footer { padding: 2rem 0; color: var(--muted); font-size: .85rem; text-align: center; }

/* printable documents */
.printpage { background: #fff; }
.printbar { padding: .75rem 16px; border-bottom: 1px solid var(--line); display: flex; gap: 1rem; align-items: center; }
.doc { max-width: 800px; margin: 1.5rem auto; padding: 0 16px; }
.doc-title { text-align: center; letter-spacing: .5em; border-bottom: 3px double var(--text); padding-bottom: .5rem; }
.doc-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.doc-to { font-size: 1.2rem; border-bottom: 1px solid var(--text); display: inline-block; min-width: 12rem; }
.doc-from { text-align: right; }
.doc-amount { font-size: 1.2rem; border: 2px solid var(--text); padding: .5rem 1rem; display: inline-block; }
.doc-amount strong { font-size: 1.5rem; }
.doc-table th { background: #f2f3f5; }
.doc-sum { max-width: 360px; margin-left: auto; margin-top: 1rem; }
@media print {
  .noprint { display: none !important; }
  .doc { margin: 0; max-width: none; }
  body { font-size: 12px; }
}

@media (max-width: 600px) {
  .row3 { grid-template-columns: 1fr 1fr; }
  .product { flex-direction: column; }
  .product-side { text-align: left; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
  .addcart { justify-content: flex-start; margin: 0; }
  .lp-hero h1 { font-size: 1.9rem; }
  .dl { grid-template-columns: 5rem 1fr; }
}

/* barcode picking */
.scan-controls { display: flex; gap: .5rem; margin-bottom: .5rem; }
.scan-controls input { flex: 1; }
#scan-video { width: 100%; max-height: 260px; object-fit: cover; border-radius: 8px; background: #000; margin-bottom: .5rem; }
.scan-msg { min-height: 1.5rem; font-weight: 600; margin-bottom: .5rem; }
.scan-msg.ok { color: var(--ok-ink); }
.scan-msg.err { color: var(--danger); }
.progress { height: 8px; background: #e5e7eb; border-radius: 999px; overflow: hidden; margin-bottom: .75rem; }
.progress div { height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.picking tr.pick-done td { background: var(--ok-bg); }
.picking tr.pick-over td { background: var(--err-bg); }
.pick-cell { white-space: nowrap; }
.pick-btns { display: flex; gap: .25rem; margin-top: .25rem; }
svg.ean { display: block; width: 120px; height: auto; margin-top: .25rem; }
.form label .scan-fill { margin-top: .35rem; }
.doc-kind { text-align: center; margin-top: -.5rem; font-size: .9rem; }
@media print { .page-break { page-break-before: always; } }
