/* 在庫管理表（ZQT Lab.） 色と部品はシフト表のツールに合わせる */
:root {
  --ink: #1d2733;
  --ink-soft: #4a5866;
  --navy: #1e3a5c;
  --navy-deep: #132a45;
  --gold: #b9893f;
  --gold-pale: #f6ecda;
  --bg: #faf8f4;
  --tint: #eef2f6;
  --line: #d9dfe6;
  --white: #ffffff;
  --red: #b23b3b;
  --red-pale: #fbe6e4;
  --green: #2f7d5b;
  --green-pale: #e7f3ec;
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", "Noto Sans JP", sans-serif;
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.75; font-size: 15px; overflow-wrap: anywhere; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy); }
p { margin: 0 0 .8em; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.print-only { display: none; }
[hidden] { display: none !important; }

/* 見出し */
.top { padding: 36px 0 18px; }
.kicker { color: var(--gold); font-weight: 700; font-size: 13px; letter-spacing: .12em; margin: 0 0 2px; }
.top h1 { font-family: var(--serif); font-size: 26px; line-height: 1.4; margin: 0 0 12px; color: var(--navy-deep); word-break: auto-phrase; }
.h1-sub { display: block; font-size: 16px; color: var(--ink-soft); font-family: var(--font); font-weight: 700; margin-top: 4px; }
.lead { color: var(--ink-soft); max-width: 52em; }
.lead strong { color: var(--ink); background: linear-gradient(transparent 62%, var(--gold-pale) 62%); }
.steps { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 6px; counter-reset: st; }
.steps li { counter-increment: st; }
.steps a { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; text-decoration: none; background: var(--white); border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px 3px 4px; color: var(--ink); transition: border-color .2s, transform .2s; }
.steps a::before { content: counter(st); display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 11px; font-weight: 700; }
.steps a:hover { border-color: var(--navy); transform: translateY(-1px); }

/* 見本の帯・容量の注意 */
.sample-bar { display: flex; flex-direction: column; gap: 10px; background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--navy); border-radius: 12px; padding: 14px 16px; margin: 0 0 18px; }
.sample-bar.is-sample { border-left-color: var(--gold); background: #fffaf1; }
.sample-bar p { margin: 0; font-size: 14px; }
.sample-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.cap-warn { background: var(--red-pale); color: var(--red); border: 1px solid #efc9c5; border-radius: 10px; padding: 10px 14px; margin: 0 0 18px; font-size: 14px; font-weight: 700; }

/* 今の状況 */
.status { margin: 0 0 18px; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile { display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; text-decoration: none; color: var(--ink); }
.tile span { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.tile b { font-size: 20px; color: var(--navy-deep); line-height: 1.3; font-variant-numeric: tabular-nums; }
.tile b.bump { animation: bump .45s ease; }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.12); color: var(--gold); } 100% { transform: scale(1); } }
.tile-alert.has { background: var(--red-pale); border-color: #e7b3ad; }
.tile-alert.has b { color: var(--red); }
.order-box { margin-top: 10px; }
.order-box:empty { display: none; }
.order { border: 2px solid var(--red); background: #fff7f6; border-radius: 12px; padding: 12px 14px; animation: rowIn .3s ease; }
.order h2 { font-size: 16px; color: var(--red); margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }
.order h2::before { content: "!"; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--red); color: #fff; font-size: 14px; flex: none; }
.order ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.order li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; font-size: 14px; border-top: 1px dashed #efc9c5; padding-top: 4px; }
.order li:first-child { border-top: none; padding-top: 0; }
.order li b { color: var(--ink); }
.order li .o-num { color: var(--red); font-weight: 700; }
.order li .o-sub { color: var(--ink-soft); font-size: 13px; }
.order-ok { background: var(--green-pale); color: var(--green); font-weight: 700; border-radius: 10px; padding: 8px 12px; font-size: 14px; }

/* カード */
.card { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 18px 16px; margin: 0 0 18px; min-width: 0; scroll-margin-top: 12px; }
.card h2 { font-size: 19px; color: var(--navy-deep); display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.card h2 .no { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 14px; flex: none; }
.card.editing { box-shadow: 0 0 0 3px rgba(185, 137, 63, .35); }
.h3 { font-size: 16px; color: var(--navy-deep); margin: 22px 0 6px; }
.lead-s { color: var(--ink-soft); font-size: 14px; }
.note { color: var(--ink-soft); font-size: 13px; margin: 6px 0 8px; }

/* 入力欄 */
.form-row { display: flex; flex-wrap: wrap; gap: 12px 14px; margin-bottom: 12px; align-items: flex-end; }
.fld { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fld > span { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.fld-wide { flex: 1 1 260px; }
.fld-code { flex: 1 1 260px; max-width: 420px; }
.fld-mid { flex: 1 1 140px; max-width: 220px; }
.fld-s { width: 90px; }
.fld-num { width: 120px; }
.fld-date { width: 160px; }
.fld-memo { flex: 1 1 200px; }
.fld-sel { width: 140px; }
input[type="text"], input[type="number"], input[type="date"], input[type="search"], select {
  width: 100%; min-width: 0; height: 40px; padding: 0 10px; border: 1px solid #c6ced8; border-radius: 8px; background: #fff; transition: border-color .15s, box-shadow .15s;
}
textarea { width: 100%; min-width: 0; padding: 8px 10px; border: 1px solid #c6ced8; border-radius: 8px; background: #fff; font-size: 13px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(30, 58, 92, .18); }
input.bad { border-color: var(--red); box-shadow: 0 0 0 3px rgba(178, 59, 59, .15); }
.code-pick { display: flex; gap: 6px; min-width: 0; }
.code-pick input { flex: 1 1 auto; }
.btn-cam { flex: none; min-height: 40px; padding: 0 12px; font-size: 13px; border-width: 1px; }
.cam-msg { background: var(--gold-pale); color: #7a5212; border-radius: 8px; padding: 6px 10px; font-size: 13px; margin: -4px 0 10px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; min-height: 40px; }
.check input { width: 18px; height: 18px; accent-color: var(--navy); flex: none; }

/* 記録の種類 */
.kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.kind { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 58px; padding: 6px 4px; border: 2px solid #c6ced8; border-radius: 12px; cursor: pointer; background: #fff; text-align: center; transition: background .15s, border-color .15s, color .15s, transform .15s; user-select: none; }
.kind input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kind b { font-size: 16px; line-height: 1.3; }
.kind small { font-size: 11px; color: var(--ink-soft); line-height: 1.3; }
.kind:active { transform: scale(.97); }
.kind:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(30, 58, 92, .25); }
.k-in.on { border-color: var(--green); background: var(--green-pale); color: var(--green); }
.k-out.on { border-color: var(--red); background: var(--red-pale); color: var(--red); }
.k-cnt.on { border-color: var(--navy); background: var(--tint); color: var(--navy); }
.kind.on small { color: inherit; }

.picked { min-height: 26px; font-size: 14px; margin: -4px 0 10px; color: var(--ink-soft); }
.picked:empty { min-height: 0; margin: 0; }
.picked b { color: var(--ink); }
.picked .p-stock { display: inline-block; margin-left: 6px; font-weight: 700; color: var(--navy); }
.picked .p-low { color: var(--red); }
.picked .p-new { color: #7a5212; }
.picked .code { color: var(--ink-soft); font-size: 12px; }
.picked button { margin-left: 6px; }
.rec-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.recent { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 4px; }
.recent li { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; font-size: 13px; padding: 6px 10px; background: #fcfcfb; border: 1px solid var(--line); border-radius: 8px; animation: rowIn .3s ease; }
.recent li.new { animation: recIn .6s ease; }
@keyframes recIn { 0% { opacity: 0; transform: translateY(-6px); background: var(--gold-pale); } 60% { background: var(--gold-pale); } 100% { opacity: 1; transform: none; } }
.recent .r-main { flex: 1 1 200px; min-width: 0; }
.recent .r-after { color: var(--ink-soft); }
@keyframes rowIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* 種類の札 */
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 0 7px; border-radius: 5px; line-height: 20px; white-space: nowrap; }
.tag-入 { background: var(--green-pale); color: var(--green); }
.tag-出 { background: var(--red-pale); color: var(--red); }
.tag-棚 { background: var(--tint); color: var(--navy); }

/* ボタン */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border-radius: 999px; font-weight: 700; cursor: pointer; border: 2px solid var(--navy); transition: background .2s, color .2s, transform .15s, box-shadow .2s; text-align: center; line-height: 1.3; }
.btn:active { transform: scale(.97); }
.btn-main { background: var(--navy); color: #fff; }
.btn-main:hover { background: var(--navy-deep); }
.btn-sub { background: #fff; color: var(--navy); }
.btn-sub:hover { background: var(--tint); }
.btn-s { min-height: 34px; font-size: 13px; padding: 0 14px; }
.btn-big { width: 100%; min-height: 54px; font-size: 18px; background: var(--gold); border-color: var(--gold); color: #fff; box-shadow: 0 6px 16px rgba(185, 137, 63, .28); }
.btn-big:hover { background: #a7792f; box-shadow: 0 8px 20px rgba(185, 137, 63, .36); }
.btn-big.k-入 { background: var(--green); border-color: var(--green); box-shadow: 0 6px 16px rgba(47, 125, 91, .25); }
.btn-big.k-出 { background: var(--red); border-color: var(--red); box-shadow: 0 6px 16px rgba(178, 59, 59, .25); }
.btn-big.k-棚 { background: var(--navy); border-color: var(--navy); box-shadow: 0 6px 16px rgba(30, 58, 92, .25); }
.btn-link { border: none; background: none; color: var(--navy); text-decoration: underline; cursor: pointer; padding: 2px 4px; font-size: 13px; }
.btn-link.del { color: var(--red); }
.item-btns, .out-btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }

/* 絞り込み */
.filter { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin-bottom: 6px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.quick .btn.on { background: var(--navy); color: #fff; }
.log-sum { font-size: 13px; color: var(--ink-soft); margin: 6px 0 0; }

/* 表 */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; background: #fff; }
.tbl { border-collapse: separate; border-spacing: 0; font-size: 13px; width: 100%; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: 7px 10px; text-align: left; white-space: nowrap; }
.tbl tbody tr:last-child > * { border-bottom: none; }
.tbl thead th { background: var(--tint); font-weight: 700; color: var(--navy-deep); font-size: 12px; position: sticky; top: 0; }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .nm { position: sticky; left: 0; background: #fff; z-index: 1; max-width: 180px; overflow: hidden; text-overflow: ellipsis; font-weight: 700; box-shadow: 1px 0 0 var(--line); }
.tbl thead .nm { background: var(--tint); z-index: 2; }
.tbl .code { color: var(--ink-soft); font-size: 12px; font-variant-numeric: tabular-nums; }
.tbl .memo { white-space: normal; min-width: 120px; max-width: 260px; color: var(--ink-soft); }
.tbl tfoot td, .tbl tfoot th { border-top: 2px solid #c6ced8; font-weight: 700; background: #fafbfc; }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr:hover > * { background: #f7f9fb; }
.stock tr.low > *, .stock tr.low .nm { background: #fff3f1; }
.stock tr.low .qty { color: var(--red); font-weight: 700; }
.stock tr.low .qty::after { content: "発注"; display: inline-block; margin-left: 6px; font-size: 11px; color: #fff; background: var(--red); border-radius: 4px; padding: 0 5px; line-height: 18px; vertical-align: 1px; }
.stock .qty { font-weight: 700; font-size: 14px; }
.stock .neg { color: var(--red); }
.stock tr.flash > * { animation: flashRow 1s ease; }
@keyframes flashRow { 0%, 40% { background: var(--gold-pale); } 100% { background: transparent; } }
.log .diff-p { color: var(--green); font-weight: 700; }
.log .diff-m { color: var(--red); font-weight: 700; }
.empty { padding: 22px 12px; text-align: center; color: var(--ink-soft); background: var(--tint); }

/* 使い方・よくある質問 */
.howto ol { margin: 0; padding-left: 1.4em; font-size: 14px; color: var(--ink-soft); }
.howto li { margin: 4px 0; }
.faq dl { margin: 0; }
.faq dt { font-weight: 700; margin-top: 12px; color: var(--navy-deep); }
.faq dt::before { content: "Q. "; color: var(--gold); }
.faq dd { margin: 2px 0 0; color: var(--ink-soft); font-size: 14px; }
.squash { margin-top: 12px; }
.squash summary { cursor: pointer; font-weight: 700; color: var(--navy); padding: 6px 0; font-size: 14px; }

/* 下の導線（控えめ） */
.foot { padding: 18px 0 28px; font-size: 12px; color: var(--ink-soft); text-align: center; }
.foot p { margin: 0; }

/* 確認・カメラ・通知 */
.dlg { border: none; border-radius: 14px; padding: 22px 20px 18px; width: min(420px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(19, 42, 69, .3); color: var(--ink); }
.dlg::backdrop { background: rgba(19, 42, 69, .45); }
.dlg[open] { animation: dlgIn .2s ease; }
@keyframes dlgIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.dlg-btns { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.dlg-cam { width: min(480px, calc(100vw - 24px)); padding: 16px; }
.cam-head { font-weight: 700; margin: 0 0 8px; }
.cam-view { position: relative; background: #0d1620; border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 3; }
.cam-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-line { position: absolute; left: 10%; right: 10%; top: 50%; height: 2px; background: rgba(255, 90, 90, .9); box-shadow: 0 0 10px rgba(255, 90, 90, .8); animation: scan 1.6s ease-in-out infinite alternate; }
@keyframes scan { from { transform: translateY(-40px); } to { transform: translateY(40px); } }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 20px); max-width: calc(100vw - 32px); background: var(--navy-deep); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 700px) {
  .wrap { padding: 0 24px; }
  .top { padding: 52px 0 24px; }
  .top h1 { font-size: 34px; }
  .h1-sub { display: inline; font-size: 20px; margin-left: 6px; }
  .card { padding: 24px; }
  .sample-bar { flex-direction: row; align-items: center; justify-content: space-between; }
  .sample-btns { flex: none; }
  .btn-big { width: auto; min-width: 300px; }
  .tile { padding: 12px 18px; }
  .tile b { font-size: 26px; }
  .kinds { max-width: 560px; }
}
@media (max-width: 420px) {
  .tile b { font-size: 17px; }
  .fld-num, .fld-date { width: calc(50% - 7px); }
  .fld-s { width: calc(50% - 7px); }
  .fld-mid { max-width: none; flex-basis: calc(50% - 7px); }
  .fld-sel { width: calc(50% - 7px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; animation-delay: 0s !important; }
}

/* 印刷: 在庫一覧か棚卸表だけを A4 縦で */
@media print {
  @page { size: A4 portrait; margin: 10mm; }
  html, body { background: #fff; font-size: 9pt; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .no-print, .toast, .dlg, main, .foot, .top { display: none !important; }
  .print-only { display: block; }
  .print-area h1 { font-family: var(--serif); font-size: 14pt; margin: 0 0 1mm; }
  .print-area .p-meta { font-size: 8.5pt; color: #444; margin: 0 0 3mm; }
  .print-area table { width: 100%; border-collapse: collapse; font-size: 8.5pt; }
  .print-area th, .print-area td { border: 1px solid #999; padding: 1.2mm 1.6mm; text-align: left; }
  .print-area thead th { background: #e9edf1; }
  .print-area thead { display: table-header-group; }
  .print-area .r { text-align: right; }
  .print-area .low td { background: #fdeceb; }
  .print-area .blank { width: 22mm; }
  .print-area tfoot td { font-weight: 700; background: #f4f5f6; }
  tr { break-inside: avoid; }
}
