/* ペット火葬 予約・顧客管理（デモ） */
:root {
  --bg: #f5f3ef; --panel: #fff; --ink: #2b2a28; --muted: #77736c; --line: #e3ded6;
  --accent: #5b6b4e; --accent-ink: #fff; --accent-soft: #e8ede2;
  --warn: #9a6a00; --warn-bg: #fff6df; --bad: #a8322d; --bad-bg: #fdecea; --ok-bg: #eaf4e6;
  --side: #3e4636; --side-ink: #e9ece4;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1d1b; --panel: #262825; --ink: #e8e6e1; --muted: #a09c94; --line: #3a3c37;
    --accent: #8ea57a; --accent-ink: #11140f; --accent-soft: #2f3829;
    --warn: #e0b24a; --warn-bg: #3a3120; --bad: #f08a83; --bad-bg: #3b2322; --ok-bg: #26341f;
    --side: #151714; --side-ink: #d8dcd2;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 22px; margin: 4px 0 16px; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 16px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.big { font-size: 17px; font-weight: 600; }
.warn-text { color: var(--warn); font-weight: 600; }
.pre { white-space: pre-wrap; }

.demo-bar { background: #7a4b12; color: #fff; text-align: center; font-size: 12.5px; padding: 4px 8px; }
header.top { position: relative; z-index: 30; display: flex; align-items: center; gap: 12px; background: var(--side); color: var(--side-ink); padding: 10px 16px; }
header.top .brand { color: var(--side-ink); font-weight: 700; text-decoration: none; flex: 1; }
header.top .logout { color: var(--side-ink); font-size: 13px; }
.menu-btn { display: none; background: none; border: 0; color: var(--side-ink); font-size: 22px; cursor: pointer; }

.wrap { display: flex; min-height: calc(100vh - 80px); }
nav.side { width: 190px; flex-shrink: 0; background: var(--side); padding: 8px 0; }
nav.side a { display: flex; gap: 8px; align-items: center; color: var(--side-ink); text-decoration: none; padding: 9px 18px; font-size: 14px; }
nav.side a:hover { background: rgba(255,255,255,.07); }
nav.side a.on { background: rgba(255,255,255,.14); font-weight: 700; }
nav.side .ic { width: 20px; text-align: center; }
main { flex: 1; min-width: 0; padding: 20px 24px 80px; max-width: 1200px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; background: var(--ok-bg); }
.flash.warn { background: var(--warn-bg); }
.flash.err { background: var(--bad-bg); color: var(--bad); }

.panel, .box { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.warn-panel { border-color: var(--warn); background: var(--warn-bg); }
.box summary { cursor: pointer; font-weight: 600; }
.box.danger summary { color: var(--bad); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.two > .panel { margin-bottom: 0; }
.two { margin-bottom: 16px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.card { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; text-decoration: none; color: var(--ink); }
.card-n { font-size: 26px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.card-l { font-size: 12.5px; color: var(--muted); }
.card.warn { border-color: var(--warn); background: var(--warn-bg); }
.card.bad { border-color: var(--bad); background: var(--bad-bg); }
.small-cards .card-n { font-size: 20px; }

.btn { display: inline-block; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; padding: 8px 14px; font: inherit; font-size: 14px; cursor: pointer; text-decoration: none; line-height: 1.3; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.big-btn { padding: 12px 20px; font-size: 16px; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }
label .link { align-self: flex-start; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
form.inline { display: inline-flex; gap: 6px; align-items: center; margin: 2px 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }

label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--muted); }
input, select, textarea { font: inherit; font-size: 15px; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type=checkbox] { width: auto; }
.check-inline { flex-direction: row; align-items: center; gap: 6px; color: var(--ink); font-size: 14px; }
.narrow { width: 90px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 14px; }
.grid.tight { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); align-items: end; }
.span2 { grid-column: span 2; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; }
.checks label { flex-direction: row; align-items: center; gap: 6px; color: var(--ink); font-size: 14px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.filters input, .filters select { width: auto; }
.filters .grow { flex: 1; min-width: 220px; }

.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; background: var(--panel); }
table.list th, table.list td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 14px; }
table.list th { font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: var(--accent-soft); }
table.list tr.sum td { font-weight: 700; }
tr.struck td { opacity: .5; text-decoration: line-through; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 4px 0; }

dl.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: 13px; }
dl.kv dd { margin: 0; }

.badge { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 999px; font-weight: 600; white-space: nowrap; background: #e5e2dc; color: #4d4a44; }
.b-gray { background: #e5e2dc; color: #4d4a44; }
.b-yellow { background: #fbecb8; color: #6b4e00; }
.b-blue { background: #dbe7f7; color: #1f4b82; }
.b-purple { background: #e8def6; color: #50307f; }
.b-green { background: #d8ecd2; color: #2d5b22; }
.b-green2 { background: #c3dcc0; color: #214a1a; }
.b-red { background: #f5d5d2; color: #8a2621; }
.b-orange { background: #fbdcc0; color: #7c3d00; }

.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.prod { flex-direction: row; justify-content: space-between; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; color: var(--ink); font-size: 14px; }
.prod input { width: 64px; text-align: right; }
.total-box { margin-top: 14px; border-top: 2px solid var(--line); padding-top: 10px; }
.total-box .total { font-size: 20px; text-align: right; margin-top: 6px; }
.notes div { color: var(--warn); font-size: 13px; margin-top: 4px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; display: flex; gap: 8px; border-top: 1px solid var(--line); }

.cand { background: var(--warn-bg); border: 1px solid var(--warn); border-radius: 8px; padding: 10px 12px; margin-top: 10px; font-size: 13.5px; }
.cand-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px dashed var(--line); padding-top: 6px; margin-top: 6px; }

.sig-pad { display: block; width: 100%; max-width: 600px; aspect-ratio: 600 / 220; border: 2px dashed var(--accent); border-radius: 10px; background: #fff; touch-action: none; margin: 10px 0; }
.sig-img { max-width: 320px; border-bottom: 1px solid #999; }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px; min-height: 140px; }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.day-h { font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.ev { display: flex; flex-direction: column; gap: 1px; font-size: 12.5px; text-decoration: none; color: var(--ink); background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: 6px; padding: 5px 7px; margin-bottom: 6px; }
.ev.st-仮予約 { border-left-color: #c9a227; }
.ev.st-火葬完了, .ev.st-対応完了 { opacity: .65; }

.preview { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 8px 0; }
pre.msg { white-space: pre-wrap; word-break: break-word; font: inherit; font-size: 13px; background: var(--bg); padding: 8px 10px; border-radius: 6px; margin: 6px 0 0; }

/* ログイン */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login-box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; margin: 40px auto; }
.login-box h1 { font-size: 20px; margin: 0; }

/* 書類 */
.doc-body { background: #eee; color: #111; }
.doc-tools { max-width: 760px; margin: 12px auto; display: flex; gap: 8px; align-items: center; padding: 0 16px; }
.doc { background: #fff; color: #111; max-width: 760px; margin: 0 auto 40px; padding: 48px 56px; box-shadow: 0 1px 4px rgba(0,0,0,.15); font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; }
.doc-head { text-align: center; margin-bottom: 24px; }
.doc-head h1 { font-size: 26px; letter-spacing: .3em; margin: 0; }
.doc-no { font-size: 12px; color: #555; margin: 4px 0 0; }
.doc h2 { font-size: 15px; border-bottom: 1px solid #333; margin-top: 22px; }
.doc-to { font-size: 19px; border-bottom: 1px solid #333; display: inline-block; padding: 0 24px 2px 0; }
.doc-table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.doc-table th, .doc-table td { border: 1px solid #999; padding: 7px 10px; text-align: left; font-size: 14px; }
.doc-table th { background: #f3f3f3; width: 28%; font-weight: normal; }
.doc-table tr.sum td { font-weight: 700; }
.receipt-amount { font-size: 30px; font-weight: 700; text-align: center; border-bottom: 3px double #333; margin: 18px 60px; }
.doc-date { text-align: right; }
.doc-issuer { margin-top: 36px; text-align: right; font-size: 13.5px; }
.doc-issuer p { margin: 2px 0; }
.sign-area { margin-top: 20px; border: 1px solid #999; padding: 12px; }
@media print {
  .no-print, .demo-bar { display: none !important; }
  .doc-body { background: #fff; }
  .doc { box-shadow: none; margin: 0; padding: 0; max-width: none; }
}

/* スマホ */
@media (max-width: 860px) {
  .menu-btn { display: block; }
  nav.side { display: none; position: fixed; z-index: 20; top: 0; left: 0; bottom: 0; width: 230px; padding-top: 56px; overflow-y: auto; }
  body.nav-open nav.side { display: block; }
  main { padding: 16px 16px 90px; }
  .two { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .week { grid-template-columns: 1fr; }
  .day { min-height: 0; }
  dl.kv { grid-template-columns: 90px 1fr; }
  .doc { padding: 24px 18px; }
  .receipt-amount { margin: 18px 0; }
  .filters .grow { min-width: 100%; }
}
