:root {
  --ink: #1c2430;
  --sub: #5a6472;
  --line: #d5d9de;
  --bg: #f6f5f1;
  --paper: #ffffff;
  --accent: #8a2b1f;
  --accent-soft: #f6e6e2;
  --ok: #2f6b4f;
  --ok-soft: #e3efe8;
  --warn: #9a6a00;
  --warn-soft: #fbf1d9;
  --bad: #b3261e;
  --bad-soft: #fde4e1;
  --busy: #33507a;
  --busy-soft: #e2e9f3;
  --radius: 2px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.7;
}
a { color: var(--accent); }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
header.top {
  background: var(--ink);
  color: #fff;
  border-bottom: 4px solid var(--accent);
}
header.top .wrap { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 12px; flex-wrap: wrap; }
header.top h1 { margin: 0; font-size: 20px; letter-spacing: .04em; }
header.top a { color: #fff; font-size: 13px; }
.note-fake {
  background: var(--warn-soft);
  border-bottom: 1px solid #ecd9a8;
  color: #5c4300;
  font-size: 13px;
}
.note-fake .wrap { padding-top: 6px; padding-bottom: 6px; }
main { padding: 20px 0 48px; }
h2 { font-size: 18px; margin: 28px 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--ink); }
h3, h2.demo-h { font-size: 17px; margin: 0 0 6px; padding: 0; border: 0; }
p.lead { color: var(--sub); margin: 4px 0 16px; }
.btn {
  display: inline-block;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  padding: 8px 14px;
  font: inherit;
  font-size: 14px;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  min-height: 40px;
}
.btn:hover { background: #eef0f2; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #6f2218; }
.btn:focus-visible, button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid #2b6cb0; outline-offset: 2px; }
.btn[disabled] { opacity: .45; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--sub); font-size: 13px; }
.panel { background: var(--paper); border: 1px solid var(--line); padding: 14px 16px; }
footer.foot { border-top: 1px solid var(--line); color: var(--sub); font-size: 13px; padding: 16px 0 32px; }

/* 入口のページ */
.demo-list { border-top: 1px solid var(--ink); }
.demo-item { display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; align-items: start; padding: 18px 0; border-bottom: 1px solid var(--line); }
.demo-no { font-size: 28px; font-weight: 700; color: var(--accent); line-height: 1; padding-top: 2px; }
.demo-item p { margin: 0; color: var(--sub); }
@media (max-width: 640px) {
  .demo-item { grid-template-columns: 40px 1fr; }
  .demo-item .btn { grid-column: 2; justify-self: start; }
}

/* 日次決算 */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--ink); background: var(--paper); }
.stat { padding: 12px 14px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat .k { font-size: 13px; color: var(--sub); }
.stat .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stat:nth-child(2) { border-right: 0; } .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); } }
.table-scroll { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); }
table.grid { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
table.grid th, table.grid td { border-bottom: 1px solid var(--line); padding: 7px 10px; text-align: right; white-space: nowrap; }
table.grid th { background: #eceae4; font-weight: 600; font-size: 13px; }
table.grid td:first-child, table.grid th:first-child { text-align: left; }
table.grid tr.sun td:first-child { color: var(--bad); }
table.grid tr.sat td:first-child { color: var(--busy); }
table.grid td.num button { all: unset; cursor: pointer; color: #2b5c9e; border-bottom: 1px dotted #2b5c9e; padding: 8px 2px; display: inline-block; }
table.grid td.num button:focus-visible { outline: 3px solid #2b6cb0; }
table.grid td.minus { color: var(--bad); font-weight: 600; }
table.grid tr.total td { font-weight: 700; border-top: 2px solid var(--ink); background: #faf9f6; }
.why { position: sticky; bottom: 0; background: var(--ink); color: #fff; padding: 12px 16px; margin-top: 12px; display: none; }
.why.show { display: block; }
.why .t { font-weight: 700; }
.why .close { float: right; color: #fff; background: none; border: 1px solid #fff; padding: 8px 14px; min-height: 40px; cursor: pointer; font: inherit; font-size: 14px; }
.chart { background: var(--paper); border: 1px solid var(--line); padding: 10px; }
.chart svg { display: block; width: 100%; height: auto; }

/* 卓の時計 */
.tables { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 760px) { .tables { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tbl { background: var(--paper); border: 2px solid var(--line); padding: 8px 10px; min-height: 96px; text-align: left; font: inherit; color: inherit; cursor: pointer; border-radius: var(--radius); }
.tbl .name { font-weight: 700; }
.tbl .min { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.3; }
.tbl .st { font-size: 14px; line-height: 1.4; }
.tbl.empty { color: var(--sub); }
.tbl.run { border-color: var(--busy); background: var(--busy-soft); }
.tbl.lever { border-color: var(--bad); background: var(--bad-soft); }
.tbl.bill { border-color: var(--bad); background: var(--bad); color: #fff; animation: blink 1.2s steps(2) infinite; }
.tbl.done { border-color: var(--ok); background: var(--ok-soft); }
@keyframes blink { 50% { background: #7f1b15; } }
@media (prefers-reduced-motion: reduce) { .tbl.bill { animation: none; } }
.todo { background: var(--paper); border: 1px solid var(--line); padding: 10px 14px; margin-bottom: 12px; }
.todo ul { margin: 4px 0 0; padding-left: 18px; }
dialog { border: 1px solid var(--ink); border-radius: var(--radius); padding: 0; max-width: 460px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(28,36,48,.45); }
dialog .hd { background: var(--ink); color: #fff; padding: 10px 16px; font-weight: 700; }
dialog .bd { padding: 14px 16px; }
dialog .ft { padding: 0 16px 14px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
dialog label { display: block; font-size: 13px; color: var(--sub); margin: 8px 0 4px; }
dialog input, dialog select { font: inherit; width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); }
.err { color: var(--bad); font-weight: 600; margin: 8px 0 0; }
.toast { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; display: none; max-width: calc(100% - 32px); }
.toast.show { display: block; }

/* 予約カレンダー */
.cal-scroll { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); }
.cal { display: grid; min-width: 560px; grid-auto-rows: 36px; }
.cal .h { background: #eceae4; font-weight: 600; font-size: 14px; padding: 6px 8px; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal .h.corner { border-left: 0; position: sticky; left: 0; z-index: 3; }
.cal .t { font-size: 13px; color: var(--sub); padding: 0 6px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; position: sticky; left: 0; background: var(--paper); z-index: 2; }
.cal .slot { border-bottom: 1px solid #eceef0; border-left: 1px solid var(--line); background: #fff; cursor: pointer; padding: 0; font: inherit; }
.cal .slot:hover { background: #f3f6fa; }
.cal .slot.past { background: repeating-linear-gradient(135deg, #f1f0ec 0 6px, #e8e6e0 6px 12px); cursor: not-allowed; }
.cal .slot.covered { cursor: default; }
.cal .slot.half { border-bottom: 1px solid var(--line); }
.bk { z-index: 1; margin: 1px 3px; background: var(--busy-soft); border: 1px solid var(--busy); border-left-width: 4px; font-size: 13px; padding: 2px 6px; overflow: hidden; cursor: pointer; text-align: left; color: var(--ink); font-family: inherit; line-height: 1.4; border-radius: var(--radius); }
.bk.nom { background: var(--accent-soft); border-color: var(--accent); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--sub); }
.legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 5px; vertical-align: -1px; border: 1px solid var(--busy); background: var(--busy-soft); }
.legend span.nom::before { border-color: var(--accent); background: var(--accent-soft); }
.tabs { display: flex; border-bottom: 2px solid var(--ink); gap: 0; overflow-x: auto; }
.tabs button { font: inherit; font-size: 14px; white-space: nowrap; border: 1px solid var(--line); border-bottom: 0; background: #eceae4; padding: 8px 12px; cursor: pointer; margin-right: -1px; min-height: 44px; flex: 0 0 auto; }
.tabs button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

.bk.short { white-space: nowrap; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.bk.short strong { flex: 0 0 auto; }
dialog label.check { display: flex; gap: 8px; align-items: center; color: inherit; font-size: 15px; }
dialog label.check input { width: auto; }
