:root {
  --ink: #22302a; --ink-2: #55625c; --ink-3: #7a857f;
  --line: #e0dccf; --paper: #f7f3ea; --card: #fff;
  --pine: #1e6a58; --pine-d: #154e41; --pine-l: #e3f0ec;
  --amber: #a8620b; --amber-l: #fbf0dc; --red: #b3362b; --red-l: #fbe9e6; --gray-l: #eceeea;
  --s-bg: #f2f3ef; --s-line: #dde0d9; --s-nav: #16332c;
  --first: #dbe9fa; --first-b: #2f6db5; --return: #dcf2e5; --return-b: #2c8a5a; --free: #fae6d2; --free-b: #c26a1b;
  --bar: 46px;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  color: var(--ink); font-size: 15px; line-height: 1.6;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--s-bg); overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid #e0a020; outline-offset: 1px; }
h1, h2, h3, p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

/* ===== デモバー ===== */
#demobar { height: var(--bar); background: #20201d; color: #f4f2ea; display: flex; align-items: center; gap: 12px; padding: 0 12px; }
.demo-tag { background: #f0b429; color: #20201d; font-weight: 700; font-size: 12px; padding: 2px 8px; border-radius: 3px; white-space: nowrap; }
.demo-note { font-size: 12px; color: #c9c6ba; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.seg { display: inline-flex; border: 1px solid #5a5a52; border-radius: 6px; overflow: hidden; flex: none; }
.seg button { background: none; border: 0; color: #e8e5da; padding: 5px 12px; font-size: 13px; white-space: nowrap; }
.seg button + button { border-left: 1px solid #5a5a52; }
.seg button[aria-pressed="true"] { background: #f4f2ea; color: #20201d; font-weight: 600; }
.bar-btn { background: none; border: 1px solid #5a5a52; color: #e8e5da; border-radius: 6px; padding: 5px 10px; font-size: 13px; white-space: nowrap; flex: none; }
.bar-btn:hover, .seg button:not([aria-pressed="true"]):hover { background: #33332e; }

/* ===== ステージ ===== */
#stage { height: calc(100vh - var(--bar)); height: calc(100dvh - var(--bar)); display: flex; }
#patient-pane { background: var(--paper); overflow-y: auto; flex: 1; min-width: 0; }
#staff-pane { overflow: hidden; flex: 1; min-width: 0; display: flex; }
#staff-root { flex: 1; min-width: 0; container-type: inline-size; display: flex; }
#stage[data-view="both"] #patient-pane { flex: 0 0 400px; border-right: 1px solid #c9c5b6; }
#stage[data-view="patient"] #staff-pane, #stage[data-view="staff"] #patient-pane { display: none; }

/* ===== 患者画面 ===== */
.p-wrap { max-width: 560px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; font-size: 16px; }
.p-head { background: var(--card); border-bottom: 1px solid var(--line); padding: 10px 16px; position: sticky; top: 0; z-index: 5; }
.p-brand { font-weight: 700; font-size: 16px; color: var(--pine-d); background: none; border: 0; padding: 0; }
.p-nav { display: flex; gap: 4px; margin: 4px -8px 0; }
.p-nav button { background: none; border: 0; padding: 6px 8px; font-size: 14px; color: var(--ink-2); border-radius: 6px; min-height: 36px; }
.p-nav button:hover { background: var(--pine-l); }
.p-nav button[aria-current="page"] { color: var(--pine-d); font-weight: 700; }
.p-body { padding: 16px; flex: 1; }
.p-foot { padding: 14px 16px; font-size: 13px; color: var(--ink-2); border-top: 1px solid var(--line); }
.p-title { font-size: 20px; font-weight: 700; margin-bottom: 12px; }
.p-sub { font-size: 16px; font-weight: 700; margin: 18px 0 8px; }
.hero { padding: 8px 0 18px; }
.hero h1 { font-size: 25px; line-height: 1.4; color: var(--pine-d); }
.hero p { margin-top: 8px; color: var(--ink-2); }
.btn-p, .btn-s { display: block; width: 100%; min-height: 54px; border-radius: 10px; font-size: 17px; font-weight: 700; padding: 10px 14px; text-align: center; }
.btn-p { background: var(--pine); color: #fff; border: 0; }
.btn-p:hover { background: var(--pine-d); }
.btn-p:disabled { background: #a9b6b0; }
.btn-s { background: var(--card); color: var(--pine-d); border: 2px solid var(--pine); }
.btn-s:hover { background: var(--pine-l); }
.btn-danger { background: var(--card); color: var(--red); border: 2px solid var(--red); }
.btn-danger:hover { background: var(--red-l); }
.stack > * + * { margin-top: 10px; }
.back { background: none; border: 0; color: var(--pine-d); padding: 6px 0; font-size: 15px; margin-bottom: 6px; min-height: 36px; }
.info { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 6px 10px; margin: 0; }
.kv dt { color: var(--ink-2); font-size: 14px; }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
table.plain { width: 100%; border-collapse: collapse; font-size: 14px; }
table.plain th, table.plain td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); font-weight: 400; }
table.plain th { color: var(--ink-2); white-space: nowrap; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 16px; list-style: none; padding: 0; }
.steps li { font-size: 12px; text-align: center; color: var(--ink-3); border-top: 4px solid var(--line); padding-top: 4px; }
.steps li.on { color: var(--pine-d); border-color: var(--pine); font-weight: 700; }
.choice2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice { background: var(--card); border: 2px solid var(--line); border-radius: 10px; min-height: 60px; padding: 10px; font-weight: 700; font-size: 17px; }
.choice small { display: block; font-weight: 400; font-size: 13px; color: var(--ink-2); }
.choice:hover { border-color: var(--pine); }
.choice[aria-pressed="true"] { border-color: var(--pine); background: var(--pine-l); }
.menu-card { display: block; width: 100%; text-align: left; background: var(--card); border: 2px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.menu-card:hover { border-color: var(--pine); }
.menu-card b { font-size: 17px; display: block; }
.menu-card .meta { font-size: 14px; color: var(--ink-2); }
.menu-card .desc { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.summary { background: var(--pine-l); border-radius: 8px; padding: 8px 12px; font-size: 14px; margin-bottom: 12px; }
.alert { border-radius: 8px; padding: 10px 12px; font-size: 15px; margin-bottom: 12px; border-left: 4px solid; }
.alert.err { background: var(--red-l); border-color: var(--red); color: #7f231a; }
.alert.warn { background: var(--amber-l); border-color: var(--amber); color: #6d4006; }
.alert.ok { background: var(--pine-l); border-color: var(--pine); color: var(--pine-d); }
.alert.info2 { background: var(--gray-l); border-color: var(--ink-3); color: var(--ink); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head b { font-size: 18px; }
.cal-nav { background: var(--card); border: 1px solid var(--line); border-radius: 8px; min-width: 64px; min-height: 40px; }
.cal-nav:disabled { opacity: .35; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal .wd { text-align: center; font-size: 12px; color: var(--ink-2); padding: 2px 0; }
.cal .wd.sun, .day.sun .d { color: var(--red); }
.cal .wd.sat, .day.sat .d { color: #2563a8; }
.day { background: var(--card); border: 1px solid var(--line); border-radius: 6px; min-height: 54px; padding: 3px 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.25; }
.day .d { font-size: 14px; }
.day .m { font-size: 17px; font-weight: 700; }
.day.open .m { color: var(--pine); }
.day.few .m { color: var(--amber); }
.day.full, .day.na { background: #f1efe7; color: var(--ink-3); }
.day.full .m, .day.na .m { color: #8a8f8c; font-weight: 400; }
.day:not(:disabled):hover { border-color: var(--pine); }
.day[aria-pressed="true"] { background: var(--pine); border-color: var(--pine); }
.day[aria-pressed="true"] .d, .day[aria-pressed="true"] .m { color: #fff; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--ink-2); margin-top: 8px; }
.times { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.time { background: var(--card); border: 2px solid var(--line); border-radius: 8px; min-height: 52px; font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.25; }
.time small { font-weight: 400; font-size: 12px; }
.time.open small { color: var(--pine); }
.time.few small { color: var(--amber); font-weight: 700; }
.time:not(:disabled):hover { border-color: var(--pine); }
.time:disabled { background: #f1efe7; color: #8a8f8c; border-color: #e8e4d8; font-weight: 400; }
.field { margin-bottom: 14px; }
.field label, .field .lbl { display: block; font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.req { color: var(--red); font-size: 12px; margin-left: 4px; font-weight: 400; }
.opt { color: var(--ink-2); font-size: 12px; margin-left: 4px; font-weight: 400; }
.input { width: 100%; min-height: 48px; border: 1px solid #b8b4a6; border-radius: 8px; padding: 8px 12px; background: #fff; font-size: 16px; }
textarea.input { min-height: 80px; }
.input.bad { border-color: var(--red); border-width: 2px; }
.ferr { color: var(--red); font-size: 14px; margin-top: 3px; }
.radio-row { display: grid; gap: 6px; }
.radio { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-height: 48px; font-weight: 400 !important; margin: 0 !important; }
.radio input { width: 20px; height: 20px; accent-color: var(--pine); flex: none; }
.demo-box { border: 1px dashed #a8a28f; border-radius: 8px; padding: 10px 12px; font-size: 13px; color: var(--ink-2); background: #fffdf6; margin-top: 18px; }
.demo-box b { color: var(--ink); }
.demo-box button { margin-top: 6px; background: var(--card); border: 1px solid #a8a28f; border-radius: 6px; padding: 6px 10px; font-size: 13px; display: block; }
.demo-box button:hover { background: var(--amber-l); }
.done-no { font-size: 30px; font-weight: 700; color: var(--pine-d); letter-spacing: .02em; }
.bubble { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; white-space: pre-wrap; }

/* ===== 共通(スタッフ) ===== */
.s-shell { flex: 1; display: flex; min-width: 0; height: 100%; }
.s-nav { width: 124px; background: var(--s-nav); color: #e4ece8; display: flex; flex-direction: column; flex: none; padding: 10px 8px; gap: 2px; }
.s-brand { font-size: 12px; line-height: 1.4; padding: 2px 6px 10px; color: #b9cbc4; }
.s-brand b { display: block; color: #fff; font-size: 14px; }
.s-nav button.nav { background: none; border: 0; color: inherit; text-align: left; padding: 9px 10px; border-radius: 6px; font-size: 14px; }
.s-nav button.nav:hover { background: #234a40; }
.s-nav button.nav[aria-current="page"] { background: #f2f3ef; color: var(--s-nav); font-weight: 700; }
.s-role { margin-top: auto; font-size: 12px; color: #b9cbc4; padding: 6px 2px 0; }
.s-role select { width: 100%; margin-top: 3px; background: #234a40; border: 1px solid #3c6659; color: #fff; border-radius: 6px; padding: 6px; font-size: 13px; }
.s-main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.s-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--s-line); }
.s-title { font-size: 17px; font-weight: 700; margin-right: 6px; }
.sbtn { background: #fff; border: 1px solid #bcc2b9; border-radius: 6px; padding: 5px 10px; font-size: 14px; min-height: 32px; white-space: nowrap; }
.sbtn:hover:not(:disabled) { background: #eef1ec; }
.sbtn.pri { background: var(--pine); border-color: var(--pine); color: #fff; font-weight: 600; }
.sbtn.pri:hover:not(:disabled) { background: var(--pine-d); }
.sbtn.danger { color: var(--red); border-color: #dcaea8; }
.sbtn.danger:hover:not(:disabled) { background: var(--red-l); }
.sbtn:disabled { opacity: .5; }
.sbtn[aria-pressed="true"] { background: var(--s-nav); border-color: var(--s-nav); color: #fff; }
.sinput { border: 1px solid #bcc2b9; border-radius: 6px; padding: 5px 8px; font-size: 14px; background: #fff; min-height: 32px; max-width: 100%; }
.sinput.wide { width: 100%; }
.spacer { flex: 1; }
.s-scroll { flex: 1; overflow: auto; padding: 12px; min-height: 0; }
.card { background: #fff; border: 1px solid var(--s-line); border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; }
.card h3 { font-size: 15px; margin-bottom: 8px; }
.note-line { font-size: 12px; color: var(--ink-2); }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th, table.grid td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--s-line); vertical-align: middle; }
table.grid th { color: var(--ink-2); font-weight: 600; background: #fafaf7; white-space: nowrap; }
table.grid tr.click { cursor: pointer; }
table.grid tr.click:hover td { background: #f3f6f2; }
table.grid tr.sel td { background: var(--pine-l); }
.chip { display: inline-block; font-size: 12px; line-height: 1.5; padding: 0 6px; border-radius: 4px; background: var(--gray-l); white-space: nowrap; }
.chip.ok { background: var(--pine-l); color: var(--pine-d); }
.chip.warn { background: var(--amber-l); color: #6d4006; }
.chip.err { background: var(--red-l); color: #7f231a; }
.chip.first { background: var(--first); color: #1d4a80; }
.chip.return { background: var(--return); color: #1b5c3c; }
.chip.free { background: var(--free); color: #7a430f; }

/* ===== 予約台帳 ===== */
.sched-body { flex: 1; display: flex; min-height: 0; }
.cal-scroll { flex: 1; overflow: auto; min-width: 0; background: #fff; }
.tt { display: grid; min-width: 480px; }
.tt-h { position: sticky; top: 0; background: #fafaf7; z-index: 3; border-bottom: 1px solid var(--s-line); font-size: 13px; font-weight: 600; text-align: center; padding: 6px 2px; border-left: 1px solid var(--s-line); }
.tt-h.t { left: 0; z-index: 4; border-left: 0; }
.tt-t { position: sticky; left: 0; background: #fafaf7; z-index: 2; font-size: 12px; color: var(--ink-2); padding: 2px 6px; border-bottom: 1px solid #eef0ea; text-align: right; }
.tt-c { border-left: 1px solid var(--s-line); border-bottom: 1px solid #eef0ea; background: none; border-top: 0; border-right: 0; padding: 0; min-width: 0; }
button.tt-c:hover { background: var(--pine-l); }
button.tt-c:hover::after { content: "＋"; color: var(--pine); }
.tt-break { grid-column: 1 / -1; background: #eceee8; color: var(--ink-2); text-align: center; font-size: 12px; padding: 2px; }
.blk { z-index: 1; margin: 1px 2px; border-radius: 5px; border: 1px solid; border-left-width: 4px; padding: 2px 5px; font-size: 12px; line-height: 1.35; text-align: left; overflow: hidden; min-width: 0; color: var(--ink); }
.blk b { font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blk .l2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.blk.first { background: var(--first); border-color: var(--first-b); }
.blk.return { background: var(--return); border-color: var(--return-b); }
.blk.free { background: var(--free); border-color: var(--free-b); }
.blk.completed { opacity: .55; }
.blk.treating { box-shadow: inset 0 0 0 2px var(--ink); }
.blk.arrived { box-shadow: inset 0 0 0 1px var(--ink); }
.blk.sel { outline: 3px solid var(--ink); outline-offset: 0; z-index: 2; opacity: 1; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; padding: 6px 12px; background: #fff; border-bottom: 1px solid var(--s-line); align-items: center; }
.closed-msg { padding: 40px 16px; text-align: center; color: var(--ink-2); }
.detail { width: 320px; flex: none; background: #fff; border-left: 1px solid var(--s-line); overflow-y: auto; padding: 12px; }
.detail h3 { font-size: 18px; }
.detail .sec { border-top: 1px solid var(--s-line); margin-top: 10px; padding-top: 10px; }
.detail .kv { grid-template-columns: 70px 1fr; font-size: 14px; }
.detail .kv dt { font-size: 13px; }
.detail .acts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.detail .acts .wide { grid-column: 1 / -1; }
.lock { background: var(--gray-l); border-radius: 6px; padding: 8px 10px; font-size: 13px; color: var(--ink-2); }
.hist { font-size: 12px; list-style: none; margin: 0; padding: 0; }
.hist li { padding: 4px 0; border-bottom: 1px dotted var(--s-line); overflow-wrap: anywhere; }
.kpis { display: flex; flex-wrap: wrap; background: #fff; border-top: 1px solid var(--s-line); }
.kpi { flex: 1; min-width: 88px; padding: 6px 12px; border-left: 1px solid var(--s-line); }
.kpi:first-child { border-left: 0; }
.kpi span { display: block; font-size: 11px; color: var(--ink-2); white-space: nowrap; }
.kpi b { font-size: 19px; font-variant-numeric: tabular-nums; }
.week { border-collapse: collapse; width: 100%; font-size: 13px; }
.week th { position: sticky; top: 0; background: #fafaf7; padding: 6px; border-bottom: 1px solid var(--s-line); z-index: 1; }
.week td { padding: 0; border: 1px solid #eef0ea; text-align: center; }
.week td.t { font-size: 12px; color: var(--ink-2); padding: 2px 6px; background: #fafaf7; width: 56px; }
.week button { width: 100%; min-height: 28px; border: 0; background: none; font-variant-numeric: tabular-nums; }
.week button:hover { outline: 2px solid var(--pine); outline-offset: -2px; }
.week .off { background: #f1f2ee; }

/* ===== モーダル ===== */
.overlay { position: fixed; inset: 0; background: rgba(20, 30, 25, .45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 24px 12px; overflow-y: auto; }
.modal { background: #fff; border-radius: 10px; width: 100%; max-width: 640px; padding: 16px 18px; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
.modal.lg { max-width: 760px; }
.modal h2 { font-size: 18px; margin-bottom: 10px; }
.modal h3 { font-size: 15px; margin: 14px 0 6px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.pick-list { border: 1px solid var(--s-line); border-radius: 6px; max-height: 180px; overflow-y: auto; }
.pick-list button { display: flex; gap: 10px; width: 100%; background: none; border: 0; border-bottom: 1px solid #eef0ea; padding: 6px 10px; text-align: left; font-size: 14px; flex-wrap: wrap; }
.pick-list button:hover { background: var(--pine-l); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px 10px; }
.form-grid label { font-size: 13px; color: var(--ink-2); display: block; }
.form-grid label .sinput { display: block; width: 100%; margin-top: 2px; color: var(--ink); }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 5px; }
.slot { background: #fff; border: 1px solid #bcc2b9; border-radius: 6px; padding: 4px; font-size: 13px; font-variant-numeric: tabular-nums; }
.slot:hover:not(:disabled) { border-color: var(--pine); background: var(--pine-l); }
.slot:disabled { background: #eff0ec; color: #8a8f8c; }
.slot[aria-pressed="true"] { background: var(--pine); border-color: var(--pine); color: #fff; font-weight: 700; }

/* ===== 患者台帳 ===== */
.two { flex: 1; min-height: 0; display: flex; }
.two .list { width: 380px; flex: none; border-right: 1px solid var(--s-line); background: #fff; display: flex; flex-direction: column; min-height: 0; }
.two .list .scroller { overflow-y: auto; flex: 1; }
.two .pane { flex: 1; overflow-y: auto; padding: 12px; min-width: 0; }
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--s-line); margin-bottom: 12px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; padding: 7px 12px; font-size: 14px; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs button[aria-selected="true"] { border-color: var(--pine); font-weight: 700; color: var(--pine-d); }

/* ===== DM・分析 ===== */
.tmpl { display: flex; flex-wrap: wrap; gap: 6px; }
.dm-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.count-row { display: flex; flex-wrap: wrap; gap: 14px; }
.count-row div span { display: block; font-size: 12px; color: var(--ink-2); }
.count-row div b { font-size: 22px; font-variant-numeric: tabular-nums; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 12px; }
.tile { background: #fff; border: 1px solid var(--s-line); border-radius: 8px; padding: 10px 12px; }
.tile span { font-size: 12px; color: var(--ink-2); display: block; }
.tile b { font-size: 24px; font-variant-numeric: tabular-nums; line-height: 1.3; }
.tile small { display: block; font-size: 12px; color: var(--ink-2); }
.bars { display: flex; align-items: flex-end; gap: 14px; height: 150px; padding-top: 18px; border-bottom: 1px solid var(--ink-3); }
.bars .b { flex: 1; max-width: 42px; background: var(--pine); border-radius: 4px 4px 0 0; position: relative; min-height: 2px; }
.bars .b span { position: absolute; top: -18px; left: 0; right: 0; text-align: center; font-size: 12px; font-variant-numeric: tabular-nums; }
.bar-labels { display: flex; gap: 14px; }
.bar-labels span { flex: 1; max-width: 42px; text-align: center; font-size: 12px; color: var(--ink-2); }
.heat { border-collapse: separate; border-spacing: 2px; font-size: 12px; }
.heat th { font-weight: 400; color: var(--ink-2); padding: 0 4px; white-space: nowrap; }
.heat td { width: 40px; height: 22px; border-radius: 3px; text-align: center; font-size: 11px; font-variant-numeric: tabular-nums; }
.heat td.none { background: #f1f2ee; }
.scale { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.scale i { display: block; width: 110px; height: 10px; border-radius: 2px; background: linear-gradient(90deg, #e6f2ee, #154e41); }
.denied { padding: 40px; text-align: center; color: var(--ink-2); }

/* ===== トースト・ツールチップ・ガイド ===== */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; pointer-events: none; }
#toast div { background: #20201d; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; box-shadow: 0 4px 16px rgba(0, 0, 0, .3); max-width: 90vw; }
#tip { position: fixed; z-index: 90; background: #20201d; color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 4px; pointer-events: none; white-space: nowrap; }
.guide ol { padding-left: 20px; margin: 6px 0; }
.guide li { margin-bottom: 4px; font-size: 14px; }
.guide h3 { margin-top: 14px; }

/* ===== 画像・イラスト ===== */
:root { --blush: #fdeaf0; --sky: #e6f0fb; --mint: #e2f5e8; --lilac: #ece6f8; --peach: #fdecd9; }
svg { display: block; }
#patient-pane { background: linear-gradient(180deg, #fbf3f6 0, #f0f7f6 420px, var(--paper) 900px); }
.badge { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; flex: none; color: #fff; }
.badge svg { width: 18px; height: 18px; }
.badge.web { background: #3f83cf; } .badge.book { background: #2f9a63; } .badge.care { background: #7a5fc0; }
.badge.dm { background: #e0802c; } .badge.patient { background: #e0668a; } .badge.sub { background: #6d7a74; }
.p-brand { display: inline-flex; align-items: center; gap: 6px; }
.p-logo { width: 28px; height: 28px; flex: none; }
.hero { padding: 0 0 16px; }
.hero-img { display: block; width: calc(100% + 32px); margin: -16px -16px 0; aspect-ratio: 16 / 11; object-fit: cover; object-position: center bottom; }
.hero-text { position: relative; background: #fff; border-radius: 14px; margin: -22px 0 0; padding: 14px 16px; box-shadow: 0 6px 20px rgba(60, 50, 60, .12); }
.hero .hero-text h1 { font-size: 22px; }
.btn-p svg { display: inline-block; width: 20px; height: 20px; vertical-align: -4px; margin-right: 6px; }
.family { display: grid; grid-template-columns: 44% 1fr; gap: 12px; align-items: center; background: var(--blush); border-radius: 14px; margin-top: 18px; overflow: hidden; padding-right: 12px; }
.family img { display: block; width: 100%; height: 100%; min-height: 170px; object-fit: cover; object-position: top; -webkit-mask-image: linear-gradient(to right, #000 78%, transparent); mask-image: linear-gradient(to right, #000 78%, transparent); }
.family h2 { font-size: 17px; line-height: 1.45; color: #a83a5e; margin-bottom: 8px; }
.ticks { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.ticks li { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.ticks svg { width: 18px; height: 18px; padding: 3px; background: #e0668a; color: #fff; border-radius: 50%; flex: none; }
.features { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.features li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 4px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.features b { font-size: 13px; }
.features span:last-child { font-size: 11px; color: var(--ink-2); }
.features .badge { width: 40px; height: 40px; }
.features .badge svg { width: 22px; height: 22px; }
.contact-img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; margin-bottom: 12px; }
.with-badge { display: flex; align-items: center; gap: 10px; }
.done-art { display: flex; justify-content: center; margin-bottom: 8px; }
.done-art svg { width: 190px; height: auto; }
.choice { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.s-brand .s-logo { display: block; width: 44px; height: 44px; padding: 5px; background: #fff; border-radius: 50%; margin-bottom: 6px; }
.s-nav button.nav { display: flex; align-items: center; gap: 8px; }
.nav-ic { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; align-items: center; justify-content: center; color: #fff; flex: none; }
.nav-ic svg { width: 15px; height: 15px; }
.nav-schedule { background: #2f9a63; } .nav-patients { background: #7a5fc0; } .nav-dm { background: #e0802c; } .nav-analytics { background: #3f83cf; } .nav-settings { background: #6d7a74; }
.empty-art { text-align: center; padding-top: 24px; }
.empty-art svg { width: 170px; height: auto; margin: 0 auto 8px; }
.who { display: flex; gap: 12px; align-items: center; }
.avatar { width: 56px; height: 56px; flex: none; }
.postcard { position: relative; overflow: hidden; background: linear-gradient(160deg, #fffdf6, #f4f9ec); border: 1px solid #dfe5cf; border-radius: 10px; padding: 46px 16px 12px; box-shadow: 0 4px 14px rgba(70, 80, 50, .12); }
.postcard .leaves { position: absolute; top: 4px; right: 8px; width: 96px; height: auto; }
.postcard-body { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.postcard-from { display: flex; align-items: center; justify-content: flex-end; gap: 5px; margin-top: 10px; font-size: 12px; color: var(--ink-2); }
.postcard-from svg { width: 20px; height: 20px; }
.cycle { list-style: none; margin: 0 0 12px; padding: 10px 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 4px; background: linear-gradient(90deg, var(--sky), var(--mint), var(--blush), var(--lilac), var(--peach)); border-radius: 10px; font-size: 13px; font-weight: 600; }
.cycle li { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.cycle li + li::before { content: "▶"; font-size: 9px; color: var(--ink-3); margin-right: 3px; }
.cycle .badge { width: 26px; height: 26px; } .cycle .badge svg { width: 15px; height: 15px; }
.ov { margin: 12px 0 0; padding: 12px; border-radius: 12px; background: linear-gradient(135deg, #f3f8fd, #fdf3f6 60%, #fff8ef); }
.ov figcaption b { display: block; font-size: 16px; }
.ov figcaption span { font-size: 13px; color: var(--ink-2); }
.ov-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.ov-card { border-radius: 10px; padding: 10px; font-size: 12px; line-height: 1.5; min-width: 0; }
.ov-card p { color: var(--ink-2); margin-top: 4px; }
.ov-head { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.ov-card.hp { background: var(--sky); } .ov-card.pt { background: var(--blush); } .ov-card.bk { background: var(--mint); }
.ov-card.cr { background: var(--lilac); } .ov-card.dm { background: var(--peach); }
.ov-card.pt img { display: block; width: 100%; height: 76px; object-fit: cover; object-position: center 15%; border-radius: 8px; margin-bottom: 6px; }
.ov-center { text-align: center; font-size: 13px; align-self: center; }
.ov-center img { display: block; width: 100%; max-width: 150px; aspect-ratio: 1; object-fit: cover; object-position: center bottom; border-radius: 50%; border: 4px solid #fff; margin: 0 auto 4px; }
.ov .cycle { margin: 0; }
@media (max-width: 560px) { .ov-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ov-center { grid-column: 1 / -1; order: -1; } }
@media (max-width: 760px) {
  .s-brand { display: none; }
  .nav-ic { width: 22px; height: 22px; }
}

/* ===== 幅に応じた調整 ===== */
@container (max-width: 860px) {
  .detail { position: fixed; right: 0; top: var(--bar); bottom: 0; z-index: 30; box-shadow: -6px 0 24px rgba(0, 0, 0, .18); max-width: 100vw; }
  .detail.empty { display: none; }
  .two { flex-direction: column; overflow-y: auto; }
  .two .list { width: auto; border-right: 0; max-height: 40%; flex: none; }
  .two .pane { overflow: visible; }
  .dm-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .demo-note { display: none; }
  #demobar { gap: 6px; padding: 0 8px; overflow-x: auto; }
  .seg button { padding: 5px 8px; font-size: 12px; }
  .bar-btn { padding: 5px 7px; font-size: 12px; }
  .seg .both-btn { display: none; }
  #stage[data-view="both"] #staff-pane { display: none; }
  #stage[data-view="both"] #patient-pane { flex: 1; border: 0; }
  .s-shell { flex-direction: column; }
  .s-nav { width: auto; flex-direction: row; align-items: center; padding: 4px; overflow-x: auto; }
  .s-brand { display: none; }
  .s-nav button.nav { white-space: nowrap; padding: 6px 10px; }
  .s-role { margin: 0 0 0 auto; padding: 0; white-space: nowrap; }
  .s-role span { display: none; }
  .s-main { min-height: 0; }
}
@media (forced-colors: active) { .blk { border: 2px solid CanvasText; } }
