:root {
  --bg: #f6f7f9; --card: #fff; --text: #1f2933; --muted: #5f6b7a; --line: #dfe3e8;
  --brand: #1f4e8c; --brand-weak: #e8f0fa; --ok: #1e7b4f; --warn: #b26a00; --ng: #b42318;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.7 "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif; }
a { color: var(--brand); }
header.site { background: var(--brand); color: #fff; }
header.site .in { max-width: 1080px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
header.site h1 { font-size: 18px; margin: 0; font-weight: 700; }
header.site .sub { font-size: 13px; opacity: .85; }
header.site a { color: #fff; }
nav.tabs { max-width: 1080px; margin: 0 auto; padding: 0 16px; display: flex; gap: 4px; flex-wrap: wrap; }
nav.tabs button { border: 0; background: transparent; color: #fff; opacity: .8; padding: 10px 14px; font: inherit; cursor: pointer; border-bottom: 3px solid transparent; }
nav.tabs button[aria-selected="true"] { opacity: 1; border-bottom-color: #fff; font-weight: 700; }
main { max-width: 1080px; margin: 0 auto; padding: 20px 16px 60px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.card h2 { font-size: 17px; margin: 0 0 6px; }
.lead { color: var(--muted); margin: 0 0 14px; font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 4px; }
label .req { color: var(--ng); margin-left: 4px; font-weight: 400; }
input, select, textarea { width: 100%; padding: 9px 10px; border: 1px solid #c4cbd4; border-radius: 6px; font: inherit; background: #fff; color: inherit; }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 6px; border: 1px solid var(--brand); background: var(--brand); color: #fff; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn.sec { background: #fff; color: var(--brand); }
.btn.sm { padding: 4px 10px; font-size: 13px; font-weight: 400; }
.btn:disabled { opacity: .5; cursor: default; }
.actions { margin-top: 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.msg { font-size: 14px; }
.msg.ok { color: var(--ok); } .msg.err { color: var(--ng); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f0f2f5; font-size: 13px; white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; white-space: nowrap; border: 1px solid currentColor; }
.badge.in { color: var(--ok); } .badge.order { color: var(--brand); }
.notice { color: var(--muted); font-size: 12px; margin-top: 4px; }
.terms ul { margin: 6px 0 0; padding-left: 1.2em; font-size: 14px; }
.terms li { margin: 2px 0; } .badge.low { color: var(--warn); } .badge.out, .badge.none { color: var(--ng); }
.book-title { font-weight: 700; }
.book-meta { color: var(--muted); font-size: 12px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.search { display: flex; gap: 8px; margin-bottom: 12px; }
.items .item { display: grid; grid-template-columns: 1fr 110px auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.note { background: var(--brand-weak); border-radius: 8px; padding: 12px 14px; font-size: 14px; }
.hidden { display: none !important; }
footer.site { text-align: center; color: var(--muted); font-size: 13px; padding: 20px 16px 40px; }
.chat-fab { position: fixed; right: 16px; bottom: 16px; z-index: 20; border: 0; border-radius: 999px; padding: 12px 20px; background: var(--brand); color: #fff; font: inherit; font-weight: 700; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.chat { position: fixed; right: 16px; bottom: 16px; z-index: 21; width: 380px; max-width: calc(100vw - 32px); height: 560px; max-height: calc(100vh - 32px); background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.2); display: flex; flex-direction: column; }
.chat header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--brand); color: #fff; border-radius: 12px 12px 0 0; }
.chat-x { border: 0; background: transparent; color: #fff; font-size: 22px; line-height: 1; cursor: pointer; }
.chat-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.bubble { padding: 8px 12px; border-radius: 10px; max-width: 88%; white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.bubble.bot { background: #f0f2f5; align-self: flex-start; }
.bubble.me { background: var(--brand-weak); align-self: flex-end; }
.bubble.err { color: var(--ng); }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.chat-form textarea { min-height: 0; resize: none; }
.chat-note { margin: 0; padding: 0 12px 8px; font-size: 11px; color: var(--muted); }
@media (max-width: 640px) {
  .items .item { grid-template-columns: 1fr 80px; }
  .items .item .btn { grid-column: 1 / -1; justify-self: start; }
  th.hide-sm, td.hide-sm { display: none; }
}
