:root {
  --ink: #1d2733;
  --sub: #5b6876;
  --line: #dfe5ea;
  --bg: #f4f7f8;
  --card: #ffffff;
  --brand: #0f766e;
  --brand-d: #0b5a54;
  --brand-soft: #e3f3f0;
  --warn: #b45309;
  --warn-soft: #fef3e2;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --ok: #15803d;
  --booked: #eceff2;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic', Meiryo, sans-serif;
  line-height: 1.7;
  font-size: 15px;
}
a { color: var(--brand); }
button { font: inherit; cursor: pointer; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 1080px; }

/* header */
.hdr { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.hdr .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .02em; text-decoration: none; color: var(--ink); }
.brand .logo { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, #14b8a6, #0f766e); display: grid; place-items: center; color: #fff; font-size: 16px; }
.hdr nav { display: flex; gap: 14px; font-size: 13px; }
.hdr nav a { text-decoration: none; color: var(--sub); }
.hdr nav a:hover { color: var(--brand); }

.demo-note { background: var(--warn-soft); color: var(--warn); font-size: 12.5px; padding: 8px 0; border-bottom: 1px solid #f6dcae; }
.demo-note .wrap { display: flex; gap: 8px; align-items: flex-start; }

h1 { font-size: 22px; line-height: 1.4; margin: 22px 0 6px; }
h2 { font-size: 17px; margin: 0 0 10px; }
.lead { color: var(--sub); margin: 0 0 16px; font-size: 14px; }

/* stepper */
.steps { display: flex; gap: 6px; margin: 14px 0 16px; padding: 0; list-style: none; }
.steps li { flex: 1; text-align: center; font-size: 11.5px; color: var(--sub); border-top: 3px solid var(--line); padding-top: 6px; }
.steps li.on { color: var(--brand); border-color: var(--brand); font-weight: 700; }
.steps li.done { color: var(--brand); border-color: #8cd3ca; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }

/* live badge */
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--sub); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 1.8s infinite; }
.live.off i { background: #9aa5b1; animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); } 70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head b { font-size: 16px; }
.cal-head button { border: 1px solid var(--line); background: #fff; border-radius: 10px; width: 38px; height: 38px; font-size: 16px; color: var(--ink); }
.cal-head button:disabled { opacity: .35; cursor: default; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { text-align: center; font-size: 11.5px; color: var(--sub); padding: 4px 0; }
.cal .dow.sun { color: #c2410c; } .cal .dow.sat { color: #1d4ed8; }
.cal .day { position: relative; border: 1px solid var(--line); background: #fff; border-radius: 10px; aspect-ratio: 1 / 1.08; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 2px; color: var(--ink); }
.cal .day .d { font-size: 15px; font-weight: 600; line-height: 1.2; }
.cal .day .m { font-size: 10.5px; color: var(--brand); font-weight: 700; }
.cal .day.none { background: transparent; border-color: transparent; }
.cal .day.na { background: #f7f9fa; color: #aab3bc; }
.cal .day.na .m { color: #aab3bc; font-weight: 400; }
.cal .day.full .m { color: var(--danger); }
.cal .day:not(.na):not(.none):hover { border-color: var(--brand); }
.cal .day.sel { background: var(--brand); color: #fff; border-color: var(--brand); }
.cal .day.sel .m { color: #d6f3ee; }
.cal .day.flash { animation: flash 1.2s ease; }
@keyframes flash { 0%, 100% { box-shadow: none; } 30% { box-shadow: 0 0 0 3px #fbbf24; } }

/* time slots */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.slot { border: 1.5px solid var(--brand); background: #fff; color: var(--brand-d); border-radius: 12px; padding: 10px 6px; font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.slot small { font-size: 11px; font-weight: 500; color: var(--sub); }
.slot:hover { background: var(--brand-soft); }
.slot.sel { background: var(--brand); color: #fff; }
.slot.sel small { color: #d6f3ee; }
.slot.booked, .slot.closed { background: var(--booked); border-color: var(--booked); color: #8b96a2; cursor: not-allowed; }
.slot.booked small, .slot.closed small { color: #8b96a2; }
.slot.flash { animation: flash 1.2s ease; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--sub); margin-top: 10px; }
.legend span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; border: 1.5px solid var(--brand); background: #fff; }
.legend span.b::before { background: var(--booked); border-color: var(--booked); }

/* forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 700; font-size: 13.5px; margin-bottom: 5px; }
.field label em { font-style: normal; font-size: 11px; background: var(--danger-soft); color: var(--danger); border-radius: 4px; padding: 1px 6px; margin-left: 6px; font-weight: 600; }
.field input { width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 12px; font: inherit; font-size: 16px; background: #fff; color: var(--ink); }
.field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field.err input { border-color: var(--danger); }
.field .msg { color: var(--danger); font-size: 12.5px; margin-top: 4px; display: none; }
.field.err .msg { display: block; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px; padding: 13px 20px; font-weight: 700; font-size: 15px; background: var(--brand); color: #fff; text-decoration: none; }
.btn:hover { background: var(--brand-d); }
.btn.ghost { background: #fff; color: var(--ink); border: 1.5px solid var(--line); }
.btn.ghost:hover { background: #f4f7f8; }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn-row { display: flex; gap: 10px; margin-top: 6px; }
.btn-row .btn { flex: 1; }

.summary { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.summary div { display: flex; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.summary div:last-child { border: 0; }
.summary dt, .summary span.k { width: 98px; color: var(--sub); flex: none; }

.alert { border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 14px; display: flex; gap: 8px; }
.alert.err { background: var(--danger-soft); color: var(--danger); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.ok { background: #e7f6ec; color: var(--ok); }

.done-mark { width: 64px; height: 64px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 32px; margin: 8px auto 10px; }
.mail { background: #fafbfc; border: 1px dashed #b9c4cd; border-radius: 12px; padding: 14px; font-size: 13px; white-space: pre-wrap; color: #3b4756; }
.mail-h { font-size: 12px; color: var(--sub); margin: 14px 0 6px; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 30px); background: #1d2733; color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 13.5px; opacity: 0; transition: .3s; z-index: 50; max-width: calc(100% - 32px); pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

footer { text-align: center; color: var(--sub); font-size: 12px; padding: 26px 16px 40px; }

/* admin */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; background: #f1f5f7; color: var(--sub); font-weight: 600; padding: 9px 10px; white-space: nowrap; }
.tbl td { padding: 9px 10px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.tag { display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.tag.ok { background: #e7f6ec; color: var(--ok); }
.tag.ng { background: var(--booked); color: #6b7682; }
.tag.stop { background: var(--danger-soft); color: var(--danger); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.kpi b { display: block; font-size: 24px; line-height: 1.2; }
.kpi span { font-size: 12px; color: var(--sub); }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs button { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; font-size: 13px; color: var(--sub); }
.tabs button.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline input, .inline select { border: 1.5px solid var(--line); border-radius: 9px; padding: 8px 10px; font: inherit; font-size: 14px; background: #fff; }
.switch { display: inline-flex; align-items: center; gap: 10px; }
.switch button { position: relative; width: 52px; height: 30px; border-radius: 999px; border: 0; background: #b9c4cd; transition: .2s; }
.switch button::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; }
.switch button.on { background: var(--brand); }
.switch button.on::after { left: 25px; }

/* lab */
.log { background: #0f1720; color: #d7e3ee; border-radius: 12px; padding: 12px 14px; font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12.5px; max-height: 520px; overflow: auto; line-height: 1.6; }
.log .w { color: #4ade80; } .log .l { color: #fca5a5; } .log .d { color: #8aa0b4; }
.result { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.result .kpi b { font-size: 30px; }
.result .win b { color: var(--ok); } .result .lose b { color: var(--danger); }

@media (min-width: 720px) {
  body { font-size: 16px; }
  h1 { font-size: 26px; }
  .cal .day .d { font-size: 16px; }
}
