/* 顧客台帳（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 12px; }
.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; }
.priv { display: flex; flex-direction: column; gap: 8px; background: var(--tint); border: 1px solid #cfd8e2; border-radius: 12px; padding: 12px 16px; margin: 0 0 18px; }
.priv p { margin: 0; font-size: 13px; color: var(--ink-soft); }
.priv p b { display: inline-flex; align-items: center; gap: 6px; color: var(--navy-deep); margin-right: 8px; font-size: 14px; }
.priv p b::before { content: ""; width: 12px; height: 14px; border: 2px solid var(--navy); border-radius: 3px 3px 2px 2px; background: linear-gradient(var(--navy), var(--navy)) center 8px / 2px 3px no-repeat; flex: none; }
.priv .btn { align-self: flex-start; }
.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(2, 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); transition: transform .15s, box-shadow .15s; }
.tile:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(19, 42, 69, .08); }
.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); }
.tile-gold.has { background: #fff7e8; border-color: #ead2a6; }
.tile-gold.has b { color: #8a5f1c; }

/* カード */
.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-full { flex: 1 1 100%; }
.fld-mid2 { flex: 1 1 200px; }
.fld-num { width: 140px; }
.fld-date { width: 160px; }
.fld-sel { width: 160px; }
.fld-sort { width: 210px; }
input[type="text"], input[type="number"], input[type="date"], input[type="search"], input[type="tel"], input[type="email"], 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: 14px; resize: vertical; }
#pasteBox { font-size: 13px; }
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, textarea.bad { border-color: var(--red); box-shadow: 0 0 0 3px rgba(178, 59, 59, .15); }
.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; }
.form-warn { background: var(--gold-pale); color: #7a5212; border-radius: 8px; padding: 6px 10px; font-size: 13px; margin: -2px 0 10px; animation: rowIn .3s ease; }
.form-warn button { margin-left: 4px; }

/* 取り込む表の種類 */
.kinds2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; max-width: 560px; }
.kind2 { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 54px; 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; }
.kind2 input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kind2 b { font-size: 15px; line-height: 1.3; }
.kind2 small { font-size: 11px; color: var(--ink-soft); line-height: 1.3; }
.kind2:active { transform: scale(.97); }
.kind2:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(30, 58, 92, .25); }
.kind2.on { border-color: var(--navy); background: var(--tint); color: var(--navy); }
.kind2.on small { color: inherit; }

/* 分類タグ */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid #c6ced8; background: #fff; font-size: 13px; cursor: pointer; transition: background .15s, border-color .15s, color .15s, transform .15s; }
.chip:active { transform: scale(.96); }
.chip small { color: var(--ink-soft); font-size: 11px; }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip.on small { color: #d8e2ee; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: 5px; line-height: 19px; white-space: nowrap; background: var(--gold-pale); color: #7a5212; margin: 1px 4px 1px 0; }

/* ボタン */
.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-del { background: #fff; color: var(--red); border-color: var(--red); min-height: 38px; font-size: 14px; }
.btn-del:hover { background: var(--red-pale); }
.btn-s { min-height: 34px; font-size: 13px; padding: 0 14px; }
.btn-big { width: 100%; min-height: 52px; font-size: 17px; background: var(--green); border-color: var(--green); color: #fff; box-shadow: 0 6px 16px rgba(47, 125, 91, .25); }
.btn-big:hover { background: #276a4d; box-shadow: 0 8px 20px rgba(47, 125, 91, .32); }
.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; }

/* 表 */
.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: 170px; overflow: hidden; text-overflow: ellipsis; box-shadow: 1px 0 0 var(--line); }
.tbl thead .nm { background: var(--tint); z-index: 2; }
.tbl .memo { white-space: normal; min-width: 140px; max-width: 320px; }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr:hover > * { background: #f7f9fb; }
.clist tbody tr[data-id] { cursor: pointer; }
.clist .nm b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.clist .nm small { display: block; font-size: 11px; color: var(--ink-soft); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; }
.clist .tel { font-variant-numeric: tabular-nums; }
.clist .tags { white-space: normal; min-width: 90px; max-width: 200px; }
.clist .away { color: var(--red); font-weight: 700; }
.clist tr.sel > *, .clist tr.sel .nm { background: #fff7e8; }
.tbl tr.flash > * { animation: flashRow 1s ease; }
@keyframes flashRow { 0%, 40% { background: var(--gold-pale); } 100% { background: transparent; } }
.hist .amt { font-weight: 700; }
.empty { padding: 22px 12px; text-align: center; color: var(--ink-soft); background: var(--tint); white-space: normal !important; }
mark { background: #fde9a8; color: inherit; border-radius: 2px; padding: 0 1px; }

/* 顧客カード */
.kcard { border: 2px solid var(--navy); box-shadow: 0 10px 28px rgba(19, 42, 69, .12); animation: cardIn .35s ease; }
@keyframes cardIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.kc-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-start; justify-content: space-between; }
.kc-title { min-width: 0; }
.kc-kana { margin: 0; font-size: 12px; color: var(--ink-soft); letter-spacing: .05em; }
.kcard h2 { font-family: var(--serif); font-size: 24px; margin: 0; line-height: 1.35; }
.kcard h2::after { content: "様"; font-size: 15px; margin-left: 4px; color: var(--ink-soft); font-family: var(--font); }
.kc-co { margin: 2px 0 0; font-size: 13px; color: var(--ink-soft); }
.kc-co:empty { display: none; }
.kc-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.kc-tags { margin: 8px 0 0; }
.kc-tags:empty { display: none; }
.kc-info { display: grid; grid-template-columns: 1fr; gap: 0; margin: 12px 0 0; border-top: 1px solid var(--line); }
.kc-info > div { display: grid; grid-template-columns: 5.5em minmax(0, 1fr); gap: 8px; padding: 6px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.kc-info dt { color: var(--ink-soft); font-size: 12px; font-weight: 700; padding-top: 2px; }
.kc-info dd { margin: 0; min-width: 0; white-space: pre-wrap; }
.kc-info .none { color: #9aa5b1; }
.kc-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 14px 0 0; }
.kc-stats div { background: var(--tint); border-radius: 10px; padding: 8px 12px; min-width: 0; }
.kc-stats span { display: block; font-size: 11px; color: var(--ink-soft); font-weight: 700; }
.kc-stats b { font-size: 17px; color: var(--navy-deep); font-variant-numeric: tabular-nums; display: inline-block; }
.kc-stats b.bump { animation: bump .45s ease; }
.kc-rec { margin-top: 4px; }
.kc-del { margin: 12px 0 0; text-align: right; }

/* お知らせ（しばらく・誕生日・重複） */
.nt { border-top: 1px dashed var(--line); padding-top: 4px; margin-top: 8px; scroll-margin-top: 12px; }
.nt:first-of-type { border-top: none; margin-top: 0; }
.nlist { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.nlist li { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fcfcfb; font-size: 13px; animation: rowIn .3s ease both; }
.nlist li .n-main { flex: 1 1 180px; min-width: 0; }
.nlist li .n-main button { font-size: 14px; font-weight: 700; padding: 0; text-align: left; }
.nlist li .n-sub { color: var(--ink-soft); }
.nlist li .n-big { font-weight: 700; color: var(--red); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nlist.bday li .n-big { color: #8a5f1c; }
.nlist li.today { background: #fff7e8; border-color: #ead2a6; }
.n-ok { background: var(--green-pale); color: var(--green); font-weight: 700; border-radius: 10px; padding: 8px 12px; font-size: 14px; margin: 8px 0 0; }
.n-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 8px 0 0; font-size: 13px; color: var(--ink-soft); }
@keyframes rowIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.dup { border: 1px solid #e7b3ad; background: #fff7f6; border-radius: 12px; padding: 10px 12px; margin: 8px 0 0; animation: rowIn .3s ease both; }
.dup-why { font-size: 12px; font-weight: 700; color: var(--red); margin: 0 0 4px; }
.dup ul { list-style: none; margin: 0; padding: 0; }
.dup li { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; padding: 6px 0; border-top: 1px dashed #efc9c5; font-size: 13px; }
.dup li:first-child { border-top: none; }
.dup li .n-main { flex: 1 1 200px; min-width: 0; }
.dup li .n-main button { font-size: 14px; font-weight: 700; padding: 0; text-align: left; }
.dup .dup-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.dup.gone { animation: dupOut .35s ease forwards; }
@keyframes dupOut { to { opacity: 0; transform: translateX(12px); } }

/* 使い方・よくある質問 */
.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; }

/* 下の導線（控えめ） */
.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(440px, 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; }
.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, .priv { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; }
  .sample-btns, .priv .btn { flex: none; align-self: center; }
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tile { padding: 12px 18px; }
  .tile b { font-size: 26px; }
  .btn-big { width: auto; min-width: 280px; }
  .kcard h2 { font-size: 28px; }
  .kc-info { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
  .kc-info > div.wide { grid-column: 1 / -1; }
  .kc-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .tile b { font-size: 18px; }
  .fld-num, .fld-date, .fld-sel { width: calc(50% - 7px); }
  .fld-sort { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; animation-delay: 0s !important; }
}

/* 印刷: 顧客一覧は A4 横、顧客カードは A4 縦 */
@page { size: A4 portrait; margin: 10mm; }
@page yoko { size: A4 landscape; margin: 9mm; }
@media print {
  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.yoko { page: yoko; }
  .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; vertical-align: top; }
  .print-area thead th { background: #e9edf1; }
  .print-area thead { display: table-header-group; }
  .print-area .r { text-align: right; white-space: nowrap; }
  .print-area small { display: block; font-size: 7pt; color: #555; }
  .print-area .p-info th { width: 28mm; background: #f2f4f6; }
  .print-area .p-stats { margin: 3mm 0; font-size: 9pt; }
  .print-area h2 { font-size: 11pt; margin: 5mm 0 2mm; }
  .print-area tfoot td { font-weight: 700; background: #f4f5f6; }
  tr { break-inside: avoid; }
}
