/* かよい帳 お店のアプリ */
:root {
  --ground: #f3f4f8;
  --surface: #ffffff;
  --raised: #fbfbfd;
  --ink: #1b1f2e;
  --sub: #5d6276;
  --faint: #8a8fa3;
  --line: #e1e3ec;
  --indigo: #2f3a8f;
  --indigo-ink: #ffffff;
  --indigo-soft: #e9ebf7;
  --coral: #d45a41;
  --coral-soft: #fbe8e3;
  --green: #23704f;
  --green-soft: #e1f1e9;
  --amber: #9a6400;
  --amber-soft: #fbf0d6;
  --gray-soft: #eceef3;
  --shadow: 0 10px 30px -18px rgba(27, 31, 46, .35);
  --r: 14px;
  --font: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --head: "Zen Kaku Gothic Antique", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --tabbar: 64px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #12141c; --surface: #1b1e29; --raised: #20243a; --ink: #eceef6; --sub: #a4a9bd; --faint: #7b8096;
    --line: #2d3142; --indigo: #8c98f2; --indigo-ink: #12141c; --indigo-soft: #262b4a; --coral: #f08a73; --coral-soft: #3a2420;
    --green: #69c49b; --green-soft: #1b3329; --amber: #e5b453; --amber-soft: #3a2f18; --gray-soft: #262a38;
    --shadow: 0 10px 30px -18px rgba(0, 0, 0, .8);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
#app { min-height: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 15px/1.6 var(--font); -webkit-text-size-adjust: 100%; overscroll-behavior-y: contain; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--indigo); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--head); margin: 0; line-height: 1.35; text-wrap: balance; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sub { color: var(--sub); }
.faint { color: var(--faint); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* 骨組み */
.app { max-width: 720px; margin: 0 auto; min-height: 100%; padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px) + 20px); }
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--ground) 90%, transparent); backdrop-filter: blur(10px);
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; margin-right: auto; }
.brand i { width: 30px; height: 30px; border-radius: 9px; background: var(--indigo); flex: none; display: grid; place-items: center; }
.brand i svg { width: 18px; height: 18px; }
.brand b { font: 700 15px var(--head); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { display: block; font-size: 11.5px; color: var(--sub); }
.iconbtn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--sub); flex: none; }
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.demo-band { margin: 0 16px 6px; background: var(--amber-soft); color: var(--amber); border-radius: 10px; padding: 6px 12px; font-size: 12.5px; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.demo-band button { border: 0; background: none; color: inherit; text-decoration: underline; padding: 0; font-size: 12.5px; }

main { padding: 4px 16px 0; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.tabs .in { max-width: 720px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--tabbar); }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--faint); font-size: 11px; position: relative; }
.tabs a svg { width: 23px; height: 23px; }
.tabs a[aria-current="page"] { color: var(--indigo); font-weight: 700; }
.tabs a[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--indigo); }
.tabs .dot { position: absolute; top: 9px; left: calc(50% + 8px); min-width: 17px; height: 17px; border-radius: 9px; background: var(--coral); color: #fff; font: 700 10.5px/17px var(--mono); text-align: center; padding: 0 4px; }

/* 見出し */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 8px 0 12px; }
.page-head h1 { font-size: 22px; }
.page-head p { margin: 2px 0 0; color: var(--sub); font-size: 13px; }
.sec { margin: 22px 0 8px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.sec h2 { font-size: 15px; }
.sec small { color: var(--sub); font-size: 12.5px; }

/* カード・一覧 */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.row { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line);
  width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0; }
.row:last-child { border-bottom: 0; }
button.row:hover { background: var(--raised); }
.row .t { font: 600 14px var(--mono); line-height: 1.25; text-align: center; min-width: 48px; }
.row .t small { display: block; color: var(--faint); font-weight: 500; font-size: 11px; }
.row .main { min-width: 0; }
.row .name { font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.row .what { color: var(--sub); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .note { grid-column: 2 / 4; font-size: 12.5px; color: var(--sub); background: var(--gray-soft); border-radius: 8px; padding: 4px 8px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .right { text-align: right; font-size: 12.5px; color: var(--sub); white-space: nowrap; }
.row.dim .name, .row.dim .t { opacity: .5; }
.row.dim .name { text-decoration: line-through; }
.empty { padding: 22px 16px; text-align: center; color: var(--sub); font-size: 14px; }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 2px; }

.pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 0 8px; font-size: 11.5px; font-weight: 700; line-height: 20px; white-space: nowrap; }
.pill.first { background: var(--coral-soft); color: var(--coral); }
.pill.count { background: var(--indigo-soft); color: var(--indigo); }
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.due { background: var(--amber-soft); color: var(--amber); }
.pill.bad { background: var(--coral-soft); color: var(--coral); }
.pill.gray { background: var(--gray-soft); color: var(--sub); }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; text-align: left; display: block; width: 100%; text-decoration: none; color: inherit; }
.kpi small { display: block; color: var(--sub); font-size: 12px; }
.kpi b { display: block; font: 600 22px var(--mono); margin-top: 2px; }
.kpi .delta { font-size: 12px; font-weight: 700; }
.kpi .delta.up { color: var(--green); } .kpi .delta.down { color: var(--coral); }
a.kpi.alert { border-color: var(--amber); background: var(--amber-soft); }
a.kpi.alert b { color: var(--amber); }

.banner { border-radius: 12px; padding: 10px 14px; font-size: 13.5px; margin: 10px 0; }
.banner.warn { background: var(--amber-soft); color: var(--amber); }
.banner.info { background: var(--indigo-soft); color: var(--indigo); }

/* ボタン */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 700; font-size: 14.5px;
  background: var(--indigo); color: var(--indigo-ink); text-decoration: none; min-height: 44px; }
.btn.ghost { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.soft { background: var(--indigo-soft); color: var(--indigo); }
.btn.warn { background: var(--coral-soft); color: var(--coral); }
.btn.ok { background: var(--green-soft); color: var(--green); }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--indigo-ink); border-top-color: transparent; animation: spin .7s linear infinite; }
.btn svg { width: 17px; height: 17px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions.stack { display: grid; grid-template-columns: 1fr 1fr; }
.fab { position: fixed; right: max(16px, calc(50% - 344px)); bottom: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px) + 16px); z-index: 25;
  width: 56px; height: 56px; border-radius: 18px; border: 0; background: var(--coral); color: #fff; box-shadow: var(--shadow); display: grid; place-items: center; }
.fab svg { width: 26px; height: 26px; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 700; color: var(--sub); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--ground); }
.chip .num { margin-left: 4px; font-weight: 500; }

/* 入力 */
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field label, .field .lbl { font-size: 13px; font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); font-size: 16px; }
.field textarea { min-height: 88px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px var(--indigo-soft); }
.field .err { color: var(--coral); font-size: 12.5px; font-weight: 700; }
.field .hint { color: var(--sub); font-size: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; padding: 8px 0; }
.check input { width: 20px; height: 20px; accent-color: var(--indigo); margin: 1px 0 0; flex: none; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.toggle input { appearance: none; width: 46px; height: 28px; border-radius: 14px; background: var(--line); position: relative; flex: none; cursor: pointer; transition: background .2s; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.toggle input:checked { background: var(--coral); }
.toggle input:checked::after { transform: translateX(18px); }
.menu-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.menu-pick button { border: 1.5px solid var(--line); background: var(--surface); border-radius: 10px; padding: 6px 10px; font-size: 13px; text-align: left; }
.menu-pick button small { display: block; color: var(--sub); font-size: 11.5px; }
.menu-pick button[aria-pressed="true"] { border-color: var(--indigo); background: var(--indigo-soft); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--gray-soft); border-radius: 12px; padding: 3px; margin-bottom: 14px; }
.seg button { border: 0; background: none; border-radius: 9px; padding: 8px; font-weight: 700; color: var(--sub); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

/* 下から出る画面 */
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(15, 17, 26, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease-out; }
.sheet { background: var(--surface); width: 100%; max-width: 720px; max-height: 92vh; border-radius: 20px 20px 0 0; overflow: auto; overscroll-behavior: contain;
  padding: 8px 18px calc(18px + env(safe-area-inset-bottom, 0px)); animation: up .22s cubic-bezier(.2,.8,.2,1); }
.sheet .grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 10px; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.sheet-head h2 { font-size: 19px; }
.sheet-head p { margin: 2px 0 0; color: var(--sub); font-size: 13px; }
@keyframes up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.dl { display: grid; grid-template-columns: 6.5em 1fr; margin: 0 0 14px; font-size: 14px; }
.dl dt { color: var(--sub); padding: 7px 0; border-bottom: 1px solid var(--line); }
.dl dd { margin: 0; padding: 7px 0; border-bottom: 1px solid var(--line); font-weight: 700; word-break: break-word; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px) + 20px); transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--ground); border-radius: 12px; padding: 10px 16px; font-size: 14px; box-shadow: var(--shadow); max-width: calc(100% - 32px); animation: up .2s ease-out; }
.toast.bad { background: var(--coral); color: #fff; }

/* 週の予定 */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 10px; }
.week button { border: 1.5px solid transparent; background: var(--surface); border-radius: 12px; padding: 6px 0 5px; display: grid; justify-items: center; line-height: 1.25; }
.week button .dw { font-size: 11px; color: var(--sub); }
.week button .dn { font: 600 17px var(--mono); }
.week button .ct { font-size: 10.5px; color: var(--indigo); font-weight: 700; min-height: 14px; }
.week button.closed .dn, .week button.closed .ct { color: var(--faint); }
.week button.today .dn { color: var(--coral); }
.week button[aria-pressed="true"] { border-color: var(--indigo); background: var(--indigo-soft); }
.week .sun .dw { color: #c24c4c; } .week .sat .dw { color: #3f64c0; }
.weeknav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 8px; }
.weeknav b { font: 600 14px var(--mono); }

.day { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.day .hour { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.day .hour span { position: absolute; left: 8px; top: -9px; background: var(--surface); padding: 0 4px; font: 11px var(--mono); color: var(--faint); }
.day .half { position: absolute; left: 52px; right: 0; border-top: 1px dashed color-mix(in srgb, var(--line) 70%, transparent); }
.day .off { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, var(--gray-soft) 0 6px, transparent 6px 12px); }
.day .tap { position: absolute; left: 52px; right: 6px; border: 0; background: none; padding: 0; }
.day .tap:hover { background: color-mix(in srgb, var(--indigo-soft) 60%, transparent); border-radius: 8px; }
.day .ev { position: absolute; left: 56px; right: 8px; border-radius: 10px; padding: 4px 10px; text-align: left; border: 0; overflow: hidden;
  background: var(--indigo-soft); color: var(--ink); border-left: 4px solid var(--indigo); font-size: 12.5px; line-height: 1.35; }
.day .ev b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day .ev span { color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.day .ev.block { background: repeating-linear-gradient(135deg, var(--gray-soft) 0 8px, var(--surface) 8px 16px); border-left-color: var(--faint); }
.day .ev.done { background: var(--green-soft); border-left-color: var(--green); }
.day .ev.noshow { background: var(--coral-soft); border-left-color: var(--coral); }
.day .ev.first { box-shadow: inset 0 0 0 1.5px var(--coral); }
.day .now { position: absolute; left: 48px; right: 0; height: 2px; background: var(--coral); z-index: 3; }
.day .now::before { content: ""; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--coral); }
.day-closed { padding: 28px 16px; text-align: center; color: var(--sub); }

/* お客さま */
.search { position: relative; margin-bottom: 8px; }
.search input { width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 12px 11px 40px; background: var(--surface); font-size: 16px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--faint); }
.avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font: 700 15px var(--head); color: #fff; flex: none; }
.cust-head { display: flex; gap: 14px; align-items: center; margin: 8px 0 14px; }
.cust-head .avatar { width: 54px; height: 54px; border-radius: 16px; font-size: 22px; }
.cust-head h1 { font-size: 22px; }
.cust-head p { margin: 0; color: var(--sub); font-size: 13px; }
.stats4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-bottom: 12px; }
.stats4 div { background: var(--surface); padding: 10px 6px; text-align: center; }
.stats4 b { display: block; font: 600 17px var(--mono); }
.stats4 small { color: var(--sub); font-size: 11.5px; }
.hist { position: relative; padding-left: 18px; }
.hist::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.hist li { list-style: none; position: relative; padding: 6px 0; font-size: 13.5px; }
.hist li::before { content: ""; position: absolute; left: -17px; top: 12px; width: 10px; height: 10px; border-radius: 50%; background: var(--indigo); border: 2px solid var(--surface); }
.hist li.upcoming::before { background: var(--surface); border-color: var(--indigo); }
.hist li.noshow::before, .hist li.cancel::before { background: var(--coral); }
.hist ul { margin: 0; padding: 0; }
.hist .d { font: 600 13px var(--mono); }
.backlink svg { width: 18px; height: 18px; flex: none; }
.backlink { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; color: var(--indigo); text-decoration: none; font-weight: 700; font-size: 14px; margin: 6px 0 2px; }

/* 数字 */
.chart { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 12px 6px; }
.chart svg { display: block; width: 100%; height: auto; }
.chart text { fill: var(--sub); font: 11px var(--mono); }
.chart .bar { fill: color-mix(in srgb, var(--indigo) 35%, var(--surface)); }
.chart .bar.cur { fill: var(--indigo); }
.chart .grid { stroke: var(--line); }
.chart .val { fill: var(--ink); font-weight: 600; }
.big-rate { display: flex; align-items: center; gap: 16px; }
.ring { width: 84px; height: 84px; flex: none; }
.ring circle { fill: none; stroke-width: 10; }
.ring .bg { stroke: var(--gray-soft); } .ring .fg { stroke: var(--green); stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; }
.ring text { font: 700 18px var(--mono); fill: var(--ink); }
.menu-bars div { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: 13.5px; padding: 6px 0; }
.menu-bars i { grid-column: 1 / 3; height: 8px; border-radius: 4px; background: var(--indigo); display: block; }

/* ログイン */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 20px; }
.login .box { width: 100%; max-width: 380px; }
.login .mark { width: 64px; height: 64px; border-radius: 20px; background: var(--indigo); display: grid; place-items: center; margin-bottom: 18px; }
.login .mark svg { width: 36px; height: 36px; }
.login h1 { font-size: 26px; }
.login p { color: var(--sub); margin: 6px 0 22px; }
.pw { position: relative; }
.pw button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--indigo); font-weight: 700; font-size: 13px; padding: 6px; }

/* 前に見たときの画面（最新が届くまでの仮表示）。押せてしまうと古い内容を操作しかねないので触れなくする */
.staleband { font-size: 12px; color: var(--sub); padding: 6px 2px 2px; }
.stale { opacity: .5; pointer-events: none; filter: saturate(.6); }
.skel { display: grid; gap: 10px; }
.skel i { display: block; height: 64px; border-radius: var(--r); background: linear-gradient(90deg, var(--gray-soft), var(--surface), var(--gray-soft)); background-size: 200% 100%; animation: shine 1.3s ease-in-out infinite; }
@keyframes shine { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.fadein { animation: fade .2s ease-out; }

@media (min-width: 720px) {
  .kpis { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
