/* ============================================================
   共通スタイル（プロトタイプ）
   タブレット横向きを主に想定。落ち着いた診療所ふう。
   ============================================================ */
:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #26323a;
  --muted: #7a8a94;
  --line: #e3e8ec;
  --accent: #2f8fbf;
  --accent-soft: #e8f3f9;
  --fusen1: #35c0e8; /* 水色 */
  --fusen2: #94d82d; /* 黄緑 */
  --fusen3: #d6409f; /* マゼンタ */
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden; /* ページ全体はスクロールしない＝アプリシェル（中身は枠内でスクロール） */
}
a { color: inherit; text-decoration: none; }

/* レイアウト：左サイドバー + メイン */
.app { display: flex; height: 100vh; }
.sidebar {
  width: 210px; flex-shrink: 0; background: #23323b; color: #cdd8de;
  display: flex; flex-direction: column;
  height: 100vh; position: sticky; top: 0; overflow-y: auto;
  transition: width .15s ease;
}
.side-top { display: flex; align-items: center; gap: 8px; padding: 16px 12px 12px 20px; }
.brand { flex: 1; min-width: 0; font-weight: 700; color: #fff; font-size: 16px; letter-spacing: .02em; overflow: hidden; }
.brand .lb { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { display: block; font-weight: 400; color: #8aa0ac; font-size: 11px; margin-top: 2px; }
/* ロゴ（OneKarte／ワンカルテ）。LP と同じ作り＝画像ではなく文字＋CSSなので、どの解像度でもくっきり。
   LP の濃い背景用の配色（One=白／Karte=#7dc3e4）をそのまま使う。 */
.brand .logo-wm { font-size: 21px; font-weight: 900; letter-spacing: .01em; line-height: 1.05;
  -webkit-text-stroke: .5px currentColor; }
.brand .logo-wm b { color: #7dc3e4; }
.brand .logo-sub { display: block; font-size: 10px; font-weight: 500; color: #9db0bb;
  letter-spacing: .18em; margin-top: 1px; white-space: nowrap; }
.brand .ver-btn { margin-top: 4px; }
/* 版数はクリックできる（アプリの更新ダイアログが開く） */
.brand small.ver-btn { cursor: pointer; text-decoration: underline dotted #6d8593; text-underline-offset: 2px; }
.brand small.ver-btn:hover { color: #cfe1ea; }
.side-toggle { flex: none; width: 32px; height: 32px; border: none; border-radius: 8px; cursor: pointer;
  background: rgba(255,255,255,.08); color: #cdd8de; font-size: 16px; line-height: 1; }
.side-toggle:hover { background: rgba(255,255,255,.16); color: #fff; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 4px 0; }
.side-bottom { padding-top: 8px; padding-bottom: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 11px 20px;
  font-size: 14px; color: #b9c6ce; border-left: 3px solid transparent; overflow: hidden;
}
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav a.active { background: rgba(47,143,191,.18); color: #fff; border-left-color: var(--accent); }
.nav .ico { width: 18px; text-align: center; flex: none; }
.nav a .lb { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 今後追加予定グループ（設定の直上・下寄せ／見出しなし） */
/* 体験モード：別セクション扱い（下寄せ＋上下罫線） */
.nav-exp { margin-top: auto; border-top: 1px solid rgba(255,255,255,.08); border-bottom: 1px solid rgba(255,255,255,.08); padding: 6px 0; }
.nav-soon { padding-top: 6px; }
.nav a.soon { color: #93a1ab; }
.nav a.soon:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav a.soon.active { color: #fff; }
.nav a.soon .ico { opacity: .9; }

/* 準備中ページ（soon.html） */
.soon-wrap { display: flex; align-items: center; justify-content: center; min-height: 80vh; padding: 24px; }
.soon-card { text-align: center; max-width: 440px; background: #fff; border: 1px solid var(--line);
  border-radius: 16px; padding: 46px 40px; box-shadow: 0 6px 30px rgba(0,0,0,.05); }
.soon-ico { font-size: 54px; line-height: 1; margin-bottom: 14px; }
.soon-name { font-size: 22px; margin: 0 0 10px; color: var(--ink); }
.soon-badge { display: inline-block; font-size: 12px; font-weight: 600; color: #8a3ffc;
  background: #f3e9ff; padding: 4px 13px; border-radius: 20px; margin-bottom: 20px; }
.soon-desc { color: var(--ink); font-size: 15px; line-height: 1.85; margin: 0 0 18px; }
.soon-msg { color: var(--muted); font-size: 15px; line-height: 1.8; margin: 0 0 26px; }
.soon-msg b { color: #8a3ffc; }

/* 折りたたみ（アイコンのみ・WP風） */
.sidebar.collapsed { width: 62px; }
.sidebar.collapsed .brand { display: none; }
.sidebar.collapsed .side-top { justify-content: center; padding: 16px 0 12px; }
.sidebar.collapsed .nav a { justify-content: center; padding: 12px 0; border-left: none; }
.sidebar.collapsed .nav a .lb { display: none; }
.sidebar.collapsed .nav a.active { background: rgba(47,143,191,.28); }

.main { flex: 1; min-width: 0; padding: 24px 30px 40px; max-width: 1200px; height: 100vh; overflow-y: auto; }
.page-title { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.page-sub { color: var(--muted); font-size: 13px; margin: 0 0 20px; }

/* カード */
.cards { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; min-width: 150px; flex: 1;
}
.card .num { font-size: 28px; font-weight: 700; }
.card .lbl { color: var(--muted); font-size: 12px; margin-top: 2px; }
/* ダッシュのカード：内訳・補助行 */
.card-bd { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.card-bd b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.card-bd .bd-done b { color: #1e9e5a; }
.card-bd .bd-cancel b { color: #8a97a0; }
.card-sub { margin-top: 10px; font-size: 12px; color: var(--muted); }
.card-sub b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.card-sub .muted { font-size: 11px; }
/* ％の意味を示す小見出し（グレー・小さめ） */
.card-sub .pct-lb { font-size: 10px; color: var(--muted); font-weight: 400; margin-right: 2px; }
.card-sub .pct { white-space: nowrap; }   /* 「（○○率 0%）」を途中で折り返さない */

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 4px 0; margin-bottom: 20px; overflow: hidden;
}
/* セクション見出しの標準：全画面これに揃える（基準＝予約フォーム 顧客/予約内容）。
   flex＋gap:.5em により、見出しにアイコンを付けると自動で0.5em間隔になる。 */
.panel h2 { font-size: 14px; margin: 0; padding: 14px 18px; border-bottom: 1px solid var(--line); color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: .5em; }

/* テーブル */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 0.5em; font-size: 13px; border-bottom: 1px solid var(--line);
  border-right: 1px solid #edf1f3; } /* 縦罫線（横罫より薄い実線） */
tr > th:last-child, tr > td:last-child { border-right: none; }
th { color: var(--muted); font-weight: 600; font-size: 12px; background: #fafbfc; text-align: center; vertical-align: top; } /* 見出しは中央・上揃え */
tbody tr:hover { background: var(--accent-soft); cursor: pointer; }
tbody tr:last-child td { border-bottom: none; }

/* ステータスのバッジ */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge.booked { background: #e8f3f9; color: #1f6f96; }
.badge.done   { background: #e7f6ee; color: #1e7a4d; }
.badge.canceled { background: #f1f1f1; color: #888; }
.badge.noshow { background: #fdeaea; color: #c0333a; }

/* 付箋（3色チェック・詳細/ダッシュボード用の丸ドット） */
.fusen { display: inline-flex; gap: 4px; }
.dot { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid #ccd3d8; display: inline-block; }
.dot.on1 { background: var(--fusen1); border-color: var(--fusen1); }
.dot.on2 { background: var(--fusen2); border-color: var(--fusen2); }
.dot.on3 { background: var(--fusen3); border-color: var(--fusen3); }

/* 付箋ボックス（一覧上でクリックしてON/OFF＝■） */
.fusen-cells { display: inline-flex; gap: 9px; }
.fbox {
  width: 15px; height: 15px; border-radius: 4px; border: 2px solid #cfd6db;
  background: #fff; cursor: pointer; display: inline-block; transition: transform .08s, background .1s;
}
.fbox:hover { transform: scale(1.12); border-color: #9aa7af; }
.fbox.on1 { background: var(--fusen1); border-color: var(--fusen1); }
.fbox.on2 { background: var(--fusen2); border-color: var(--fusen2); }
.fbox.on3 { background: var(--fusen3); border-color: var(--fusen3); }

/* 見出しの付箋フィルタ（クリックで絞り込みトグル・✔） */
/* 空欄プレースホルダ（入力できる項目があるアピール） */
.ph { color: #c3ccd2; letter-spacing: 1px; }
/* 予約一覧：見出しの2行サブラベル（施術=施術詳細／前回施術=施術内容） */
.th-sub2 { display: block; font-size: 10px; font-weight: 400; color: var(--muted); margin-top: 2px; }
/* 予約一覧：日付見出しのステータス別集計＋日合計 */
.dg-row { display: flex; align-items: center; gap: 10px; }
.dg-date { font-size: 16px; font-weight: 700; }
.dg-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dg-badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 11px;
  font-variant-numeric: tabular-nums; }
.dg-total { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
/* 今日の予約がある日の見出し：日付の左にマゼンタ白抜きの「今日」ラベル＋日付を+2px */
.dg-today { display: inline-block; background: var(--fusen3); color: #fff; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 0; line-height: 1.5; }
.dg-date.is-today { font-size: 18px; }
/* 日付グループの開閉ボタン（明日以降は既定で閉じる） */
.dg-toggle { flex: none; width: 26px; height: 26px; margin-left: 8px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; line-height: 1; color: var(--muted);
  background: #fff; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.dg-toggle:hover { color: var(--accent); border-color: var(--accent); background: #f4fafd; }
.dg-toggle[aria-expanded="false"] { color: var(--accent); border-color: var(--accent); }
/* 予約一覧：アプリシェル（見出し・フィルタ・列見出し固定／データのみスクロール） */
.main-appts { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 20px; }
.main-appts > .page-title, .main-appts > .page-sub, .main-appts > .filters { flex: none; }
.main-appts > .panel { flex: 1; min-height: 0; overflow-y: auto; margin-bottom: 0; padding: 0; }
.main-appts table thead th { position: sticky; top: 0; background: #fff; z-index: 2; box-shadow: inset 0 -1px 0 var(--line); }
/* 顧客一覧：アプリシェル（見出し・検索・列見出し固定／データのみスクロール） */
.main-cust { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 20px; }
.main-cust > .page-title, .main-cust > .page-sub, .main-cust > .toolbar { flex: none; }
.main-cust > .panel { flex: 1; min-height: 0; overflow: auto; margin-bottom: 0; padding: 0; }
.main-cust table thead th { position: sticky; top: 0; background: #fff; z-index: 2; box-shadow: inset 0 -1px 0 var(--line); }
/* 予約一覧：年月ナビ（セレクト＋前後ボタン） */
.ymnav { display: inline-flex; align-items: center; gap: 4px; }
.ym-btn { width: 30px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  cursor: pointer; font-size: 12px; line-height: 1; color: var(--ink); padding: 0; }
.ym-btn:hover { background: #f2f6f8; }
/* 一覧の数字→顧客詳細の該当タブへ（予約/カルテ） */
.num-link { cursor: pointer; }
.num-link:hover { color: var(--accent); text-decoration: underline; }
/* 顧客詳細ヘッダーの付箋（常に編集可・□・枠色） */
.fusen-edit { display: inline-flex; gap: 8px; }
.febox { width: 18px; height: 18px; border-radius: 5px; border: 2px solid #cfd6db; background: #fff; cursor: pointer;
  transition: transform .08s, background .1s; }
.febox:hover { transform: scale(1.1); }
.febox.c1 { border-color: var(--fusen1); }
.febox.c2 { border-color: var(--fusen2); }
.febox.c3 { border-color: var(--fusen3); }
.febox.on1 { background: var(--fusen1); }
.febox.on2 { background: var(--fusen2); }
.febox.on3 { background: var(--fusen3); }
.fhead { display: inline-flex; gap: 9px; align-items: center; }
.fchk {
  width: 15px; height: 15px; border-radius: 4px; border: 2px solid;
  background: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; line-height: 1; color: #fff; font-weight: 700;
}
.fchk.c1 { border-color: var(--fusen1); }
.fchk.c2 { border-color: var(--fusen2); }
.fchk.c3 { border-color: var(--fusen3); }
.fchk .mk { visibility: hidden; }
.fchk.active.c1 { background: var(--fusen1); }
.fchk.active.c2 { background: var(--fusen2); }
.fchk.active.c3 { background: var(--fusen3); }
.fchk.active .mk { visibility: visible; }

/* 検索バー */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.search {
  flex: 1; min-width: 240px; padding: 11px 14px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.search:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.chip {
  padding: 8px 13px; border: 1px solid var(--line); border-radius: 20px; background:#fff;
  font-size: 13px; color: var(--muted); cursor: pointer;
}
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 見出し（日付グルーピング） */
.daygroup { padding: 10px 18px 4px; font-size: 12px; font-weight: 700; color: var(--accent); background:#fafbfc; }

/* 顧客詳細 */
.detail-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.avatar { width: 60px; height: 60px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display:flex; align-items:center; justify-content:center; font-size: 22px; font-weight: 700; }
.detail-head .nm { font-size: 22px; font-weight: 700; }
.detail-head .kn { color: var(--muted); font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; padding: 16px 18px; font-size: 14px; }
.grid2 .k { color: var(--muted); }
/* 基本情報1：情報グループを2列2行のボックスで（スクロールなしで収める） */
.info-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 16px 18px; align-items: stretch; }
.info-group { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; }
.ig-label { font-size: 12px; font-weight: 700; color: var(--accent); margin-bottom: 10px; }
.info-group .grid2 { padding: 0; grid-template-columns: 104px 1fr; gap: 9px 12px; align-content: start; }
/* 連絡方法（表示＝☑/□） */
.cm-view { display: flex; flex-wrap: wrap; gap: 5px 12px; }
.cm-item { font-size: 13px; color: #aeb8be; white-space: nowrap; }
.cm-item.on { color: var(--ink); font-weight: 600; }
/* メモ：管理と同じ高さで メモ1／メモ2 を上下に */
.memo-sub { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.memo-sub + .memo-sub { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.memo-sub-k { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.info-memo .ig-body { flex: 1; font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
/* 顧客削除エリア（基本情報1タブの最下部） */
.info-danger { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 4px 18px 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.info-danger .muted { font-size: 12px; }
/* 紹介者コードの照合結果 */
.ref-name { margin-top: 4px; font-size: 12px; color: var(--muted); min-height: 1em; }
.ref-name.ok { color: var(--accent); }
.ref-name.warn { color: #c0392b; }
/* 連絡方法（フォームのチェックボックス） */
.cm-checks { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.cm-chk { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.cm-chk input { width: 16px; height: 16px; }
.time { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.muted { color: var(--muted); }
.empty { padding: 20px 18px; color: var(--muted); font-size: 13px; }
.back { color: var(--accent); font-size: 13px; margin-bottom: 12px; display:inline-block; }

/* 顧客詳細：タブUI ＋ アプリシェル（戻る・氏名・タブは固定／タブ内のみスクロール） */
.main-detail { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 20px; }
.main-detail .back { flex: none; }
.main-detail #content { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.main-detail .detail-head { flex: none; }
.main-detail .tabs { flex: none; }
.main-detail .tab-body { flex: 1; min-height: 0; overflow-y: auto; }
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin: 4px 0 18px; flex-wrap: wrap; }
.tab { appearance: none; border: none; background: none; font-family: inherit; font-size: 14px; color: var(--muted);
  padding: 11px 16px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; display: inline-flex; align-items: center; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
/* データ部だけスクロールするタブ（見出し・列見出し固定）＝予約タブ等 */
.main-detail .tab-panel.tab-scroll.active { height: 100%; }
.panel-flex { display: flex; flex-direction: column; height: 100%; margin-bottom: 0; }
.panel-flex > h2 { flex: none; }
.panel-flex > .tbl-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.panel-flex .tbl-scroll thead th { position: sticky; top: 0; background: #fff; z-index: 2; box-shadow: inset 0 -1px 0 var(--line); }
/* 一覧の行右端「予/カ/写/詳」ダイレクト遷移ボタン */
.rj-cell { text-align: center; white-space: nowrap; }
.rj-group { display: inline-flex; gap: 4px; }
.rj { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 28px;
  border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--muted);
  font-size: 13px; font-weight: 700; text-decoration: none; flex: none; }
.rj:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
/* 行選択（ハイライト）＝遷移はしない。左に細いアクセントバー */
tbody tr.row-selected td { background: var(--accent-soft); }
tbody tr.row-selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

/* 予約タブの表：見出しは左右センター／最終行の下にも罫線 */
.appt-tbl thead th { text-align: center; }
.appt-tbl tbody tr:last-child td { border-bottom: 1px solid var(--line); }
/* カルテタブの表：見出しセンター／最終行の下罫線／メモは最大2行 */
.chart-tbl thead th { text-align: center; }
.chart-tbl tbody tr:last-child td { border-bottom: 1px solid var(--line); }
.memo-2line { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  overflow: hidden; line-height: 1.5; }
.photo-tbl .memo-2line[data-pedit] { cursor: pointer; }

/* リスト/グリッド 表示切替トグル（カルテ・写真タブ） */
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.vt-btn { appearance: none; border: none; background: #fff; cursor: pointer; font-size: 14px; padding: 5px 11px; color: var(--muted); line-height: 1; }
.vt-btn + .vt-btn { border-left: 1px solid var(--line); }
.vt-btn.on { background: var(--accent-soft); color: var(--accent); }

/* グリッド表示（サムネ3列・2行程度が見えて残りスクロール） */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 14px 16px; }
.grid-card { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; cursor: pointer; }
.grid-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.grid-thumb { aspect-ratio: 4 / 3; background: #f2f5f7; display: flex; align-items: center; justify-content: center; color: #aab6bd; font-size: 30px; }
.grid-thumb img { width: 100%; height: 100%; object-fit: cover; }
.grid-meta { padding: 8px 10px; }
.gm-date { font-size: 12px; font-weight: 600; }
.gm-memo { font-size: 11px; color: var(--muted); margin-top: 3px; display: -webkit-box; -webkit-box-orient: vertical;
  -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; min-height: 1.5em; }
.gm-no { position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,.55); color: #fff; font-size: 10px; padding: 1px 7px; border-radius: 10px; z-index: 1; }

/* 行/カードの操作ボタン（編集・削除） */
.col-act { text-align: center; white-space: nowrap; }
.row-del, .row-edit { appearance: none; border: none; background: none; cursor: pointer; font-size: 14px; padding: 4px 5px; border-radius: 6px; }
.row-del { color: #c0333a; }
.row-del:hover { background: #fdeeee; }
.row-edit:hover { background: var(--accent-soft); }
.card-del { position: absolute; top: 6px; right: 6px; z-index: 2; appearance: none; border: 1px solid var(--line);
  background: rgba(255,255,255,.92); cursor: pointer; font-size: 13px; padding: 3px 6px; border-radius: 7px; }
.card-del:hover { background: #fdeeee; }
.pro-badge { font-size: 9px; font-weight: 700; color: #8a3ffc; background: #f3e9ff; padding: 1px 6px; border-radius: 9px; margin-left: 5px; }
.tab-note { display: flex; gap: 16px; align-items: flex-start; padding: 20px 6px; color: var(--muted); line-height: 1.85; }
.tab-note-ico { font-size: 40px; line-height: 1; flex: none; }
.tab-note b { color: var(--ink); }
/* カルテ一覧テーブル（見出し左寄せ） */
.chart-tbl th { text-align: left; color: var(--muted); }
.chart-tbl td { vertical-align: middle; }

/* 一覧ページのアプリシェル（見出し・ボタン固定／表のみスクロール） */
.main-list { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 20px; }
.main-list .list-head { flex: none; display: flex; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.main-list .list-head .page-title { margin: 0; }
.main-list .list-head .page-sub { margin: 4px 0 0; }
.main-list .list-head > button { margin-left: auto; align-self: center; }
.main-list > .filters { flex: none; }
.main-list > .filters .btn { white-space: nowrap; }
.main-list .list-head .head-right { margin-left: auto; display: flex; align-items: center; gap: 10px; align-self: center; flex-wrap: wrap; justify-content: flex-end; }
.main-list .list-head .head-right > * { flex: 0 0 auto; }
.main-list .list-head .head-right .btn { white-space: nowrap; }
.f-select.fyear { width: auto; padding: 8px 10px; }
.main-list .list-scroll { flex: 1; min-height: 0; overflow-y: auto; margin-bottom: 0; }
.main-list .list-foot { flex: none; display: flex; flex-wrap: wrap; gap: 10px 28px; align-items: center;
  padding: 14px 2px 2px; margin-top: 12px; border-top: 1px solid var(--line); }
.list-foot .foot-grp { display: inline-flex; align-items: center; gap: 8px; }
.list-foot .foot-lb { font-size: 12px; color: var(--muted); font-weight: 600; }
.btn.sm { font-size: 12px; padding: 6px 12px; }

/* データメンテ画面 */
.dm-wrap { display: flex; flex-direction: column; gap: 16px; max-width: 720px; }
.dm-card { margin-bottom: 0; }
.dm-ico { font-size: 18px; line-height: 1; }
.dm-body { padding: 16px 20px; }
.dm-desc { color: var(--muted); font-size: 13px; margin: 0 0 14px; line-height: 1.7; }
.dm-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.dm-note { color: var(--muted); font-size: 12px; margin: 14px 0 0; }
.dm-note b { color: var(--ink); }
.dm-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.dm-row:first-of-type { border-top: none; }
.dm-row-l { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; flex: 1; }
.dm-row-title { font-size: 14px; color: var(--ink); font-weight: normal; }
.dm-row-l .dm-sub { font-size: 12px; color: var(--muted); }
.dm-date-line { font-size: 12px; color: var(--muted); }
.dm-date { color: var(--ink); font-weight: normal; font-variant-numeric: tabular-nums; }
.dm-row-r { display: flex; align-items: center; gap: 8px; flex: none; }
.dm-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #23323b; color: #fff;
  padding: 10px 18px; border-radius: 10px; font-size: 13px; z-index: 300; box-shadow: 0 4px 16px rgba(0,0,0,.22); }

/* 体験モード画面 */
.btn:disabled { opacity: .45; cursor: default; }
.demo-row { display: flex; align-items: center; gap: 12px; padding: 4px 0 14px; }
.demo-row-l { flex: 1; }
.demo-row-title { font-size: 15px; color: var(--ink); }
.demo-row-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.demo-guard { border-top: 1px solid var(--line); padding-top: 12px; }
.demo-guard-title { font-size: 13px; font-weight: 600; margin: 0 0 6px; }
.demo-guard-title.is-has { color: #c0333a; }
.demo-guard-title.is-empty { color: #1a8f4a; }
.demo-guard-text { font-size: 12px; color: var(--muted); line-height: 1.8; margin: 0; }
/* 売上経費テーブル */
.acct-tbl thead th { position: sticky; top: 0; background: #fff; z-index: 1; box-shadow: inset 0 -1px 0 var(--line); }
.acct-tbl .kb { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 12px; }
.acct-tbl .kb-sales { background: #e3f4ea; color: #1e9e5a; }
.acct-tbl .kb-exp { background: #fdecec; color: #d64545; }
.acct-tbl .kb.clickable { cursor: pointer; }
.acct-tbl .kb.clickable:hover { filter: brightness(.94); }
.acct-tbl .amt { color: var(--ink); font-variant-numeric: tabular-nums; }
/* 月グループ見出し */
.acct-tbl .month-row td { background: #eef2f5; font-weight: 700; color: var(--ink); font-size: 13px;
  padding: 8px 0.8em; border-top: 1px solid var(--line); }
.acct-tbl .month-row .mrow { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.acct-tbl .month-row .msub { font-weight: 400; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.acct-tbl .month-row .msub b { color: var(--ink); }
.acct-tbl .month-row .msub b.minus, .acct-tbl .year-total-row .msub b.minus { color: #d64545; }
/* アコーディオン（月行） */
.acct-tbl .month-row.acc { cursor: pointer; }
.acct-tbl .month-row.acc:hover td { background: #e6ecf0; }
.acct-tbl .month-row.acc.open td { background: #e3eaef; }
.acct-tbl .acc-ico { display: inline-block; width: 1.3em; color: var(--muted); font-size: 10px; vertical-align: middle; }
.acct-tbl .mcount { font-weight: 400; font-size: 11px; color: var(--muted); margin-left: 6px; }
.acct-tbl .det td { font-size: 13px; }
/* 年度合計（最終行・下部固定） */
.acct-tbl .year-total-row td { background: #dfe7ec; font-weight: 700; color: var(--ink); font-size: 13px;
  padding: 10px 0.8em; border-top: 2px solid var(--accent); position: sticky; bottom: 0; z-index: 1; }
.acct-tbl .year-total-row .mrow { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.acct-tbl .year-total-row .msub { font-weight: 700; font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
/* 絞り込み中チップ */
.fchip { display: inline-block; font-size: 12px; background: var(--accent-soft); color: var(--accent);
  padding: 2px 6px 2px 10px; border-radius: 12px; font-weight: 600; }
.fchip .fx { cursor: pointer; margin-left: 4px; font-weight: 700; }
.fchip .fx:hover { color: var(--ink); }
/* 追加モーダルのフォーム */
.mform { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; padding: 6px 2px 4px; }
.mform .mf { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.mform .mf.full { grid-column: 1 / -1; }  /* その他・適用・備考は横幅いっぱい */
.mform .mf input, .mform .mf select { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--ink); }
.mform .mf input:focus, .mform .mf select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.mform-err { color: #c0333a; font-size: 13px; min-height: 16px; padding: 6px 2px 0; }
.mform .cbx-row { display: flex; gap: 20px; padding-top: 4px; }
.mform .cbx { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--ink); cursor: pointer; }
.mform .cbx input { width: 16px; height: 16px; }

/* 施術内容のサブ行（最終施術・次回予約の下）＝常に日付の下に縦積み */
.cell2 { display: flex; flex-direction: column; align-items: center; }
.cell-main { font-weight: 400; font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; } /* 日付：通常の太さ・折り返さない・等幅数字 */
.cell-sub { color: var(--muted); font-size: 12px; margin-top: 2px; line-height: 1.3; min-height: 1.2em; white-space: nowrap; } /* 施術内容が無くても行高を確保して上下位置を揃える */
.mini-badge { display:inline-block; padding:1px 7px; border-radius:20px; font-size:11px; font-weight:600;
  background:#fdeaea; color:#c0333a; }
/* 未成年：年齢セルを薄赤背景・赤文字 */
td.age-minor { background: #fdecec; color: #c0333a; font-weight: 700; text-align: center; }

/* 見出し：ラベルの下に 🔼🔽（並び替え）/ 🔍（絞り込み）・セル内で中央 */
.th-head { display: flex; flex-direction: column; align-items: center; gap: 3px; }
/* ラベルは常に2行ぶんの高さを確保して、全見出しのアイコン列を揃える */
.th-label { text-align: center; min-height: 2.5em; display: grid; place-items: center; line-height: 1.25; }
.th-label { white-space: nowrap; }
.th-tools { display: inline-flex; gap: 5px; }
.th-tools .ic-s, .th-tools .ic-f { cursor: pointer; font-size: 12px; line-height: 1; filter: grayscale(1) opacity(.4); }
.th-tools .ic-s:hover, .th-tools .ic-f:hover { filter: none; }
.th-tools .ic-s.on, .th-tools .ic-f.on { filter: none; }
.th-sub { font-size: 11px; color: var(--muted); font-weight: 400; }
.col-popover { position: fixed; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15); padding: 6px; z-index: 300; min-width: 160px; }
.col-popover .pop-title { font-size: 12px; color: var(--muted); padding: 5px 8px 7px; }
.col-popover .pop-row { display: flex; align-items: center; gap: 9px; padding: 8px; font-size: 14px; cursor: pointer; border-radius: 6px; }
.col-popover .pop-row:hover { background: var(--accent-soft); }
.col-popover .pop-row input { width: 16px; height: 16px; }
.col-popover .pop-actions { border-top: 1px solid var(--line); margin-top: 4px; padding: 6px 6px 2px; text-align: right; }
.col-popover .pop-clear { background: none; border: none; color: var(--accent); font-size: 12px; cursor: pointer; }
.col-popover .pop-list { max-height: 220px; overflow-y: auto; }
.col-popover .pop-sub { font-size: 11px; color: var(--muted); font-weight: 600; padding: 4px 8px 3px; }
.col-popover .pop-hr { border: none; border-top: 1px solid var(--line); margin: 6px 0; }
.col-popover .pop-radios { display: flex; gap: 14px; padding: 8px 10px 2px; font-size: 14px; }
.col-popover .pop-radios label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
/* 付箋一括ポップオーバー */
.th-label.th-clickable { cursor: pointer; }
.th-label.th-clickable:hover { color: var(--accent); }
.col-popover .fbulk-colors { display: flex; gap: 16px; padding: 6px 10px 4px; }
.col-popover .fbulk-colors .fchk { width: 24px; height: 24px; font-size: 15px; }
.col-popover .pop-actions.two { display: flex; gap: 8px; text-align: left; }
.col-popover .pop-btn { flex: 1; padding: 9px 8px; border: 1px solid var(--accent); border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; white-space: nowrap; }
.col-popover .pop-btn:hover { filter: brightness(1.06); }
.col-popover .pop-btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); font-weight: 400; }
.col-popover .pop-btn.ghost:hover { background: #f2f6f8; }
.col-popover .pop-btn:disabled { opacity: .5; cursor: default; }
.col-popover .pop-note { font-size: 11px; color: #c0333a; min-height: 14px; padding: 4px 8px 0; }

/* ============ iOS風 設定画面 ============ */
.ios { max-width: 620px; }
.ios-glabel { font-size: 12px; color: var(--muted); margin: 0 0 7px 15px; }
.ios-group { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 24px; }
.ios-row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 15px; min-height: 20px; }
.ios-row:last-child { border-bottom: none; }
.ios-row .lbl { flex: 1; }
.ios-row .val { color: var(--muted); text-align: right; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ios-row.link { cursor: pointer; }
.ios-row.link:hover { background: #f7f9fa; }
.ios-row .chev { color: #c2ccd2; font-size: 20px; line-height: 1; }
.ios-row.disabled { color: #aeb8be; cursor: default; }
.ios-row.disabled:hover { background: #fff; }
.ios-hint { font-size: 12px; color: var(--muted); margin: -14px 0 24px 15px; }
/* .ios の中に .panel（表など）を置いたときも .ios-group と同じ下余白にする。
   これが無いと直後の .ios-hint（margin-top:-14px）がパネルに重なる。 */
.ios > .panel { margin-bottom: 24px; }
.badge-pro { background: #f3e9ff; color: #8a3ffc; font-size: 10px; padding: 2px 8px; border-radius: 20px; font-weight: 700; }
.badge-soon { background: #eef1f3; color: #98a4ab; font-size: 10px; padding: 2px 8px; border-radius: 20px; }

/* iOSトグルスイッチ（表セル内など flex 以外でも崩れないよう inline-block） */
.switch { position: relative; display: inline-block; vertical-align: middle; width: 46px; height: 28px; flex-shrink: 0; }
.switch input { display: none; }
.switch .track { position: absolute; inset: 0; background: #d6dbdf; border-radius: 20px; transition: .2s; }
.switch .thumb { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + .track { background: #34c759; }
.switch input:checked ~ .thumb { transform: translateX(18px); }
/* 小サイズのスイッチ（見出し内など） */
.switch.switch-sm { width: 36px; height: 20px; }
.switch.switch-sm .thumb { width: 14px; height: 14px; top: 3px; left: 3px; }
.switch.switch-sm input:checked ~ .thumb { transform: translateX(16px); }

/* 予約フォーム見出しの「PRO版（お試し）」トグル（体験モードのみ表示） */
.pro-toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.pro-toggle-lb { font-size: 12px; font-weight: 600; color: #8a3ffc; }
.pro-toggle-lb .muted { font-weight: 400; }
.svc-cap-note { font-size: 11px; margin-top: 6px; }

/* 設定フォームの入力欄（右寄せ） */
.ios-row .k { width: 140px; flex: none; color: var(--ink); }
.ios-input { flex: 1; border: none; text-align: right; font-size: 15px; background: transparent; color: var(--ink); font-family: inherit; }
.ios-input:focus { outline: none; }
.ios-input::placeholder { color: #c2ccd2; }
.saved-note { color: #1e7a4d; font-size: 12px; margin-left: 15px; }
.pw-icon { flex: none; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  cursor: pointer; font-size: 15px; line-height: 1; }
.pw-icon:hover { background: #f2f6f8; }
.pw-icon.on { background: var(--accent-soft); border-color: var(--accent); }

/* ステータス設定 */
.st-color { width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 6px; padding: 0; background: none; cursor: pointer; flex: none; }
.st-label { flex: 1; border: none; font-size: 15px; background: transparent; color: var(--ink); font-family: inherit; }
.st-label:focus { outline: none; }
.st-arrows { display: inline-flex; flex-direction: column; gap: 1px; flex: none; }
.st-arrow { width: 26px; height: 15px; border: 1px solid var(--line); background: #fff; border-radius: 5px; cursor: pointer; color: var(--muted); font-size: 10px; line-height: 1; padding: 0; }
.st-arrow:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
.st-arrow:disabled { opacity: .3; cursor: default; }
.st-del { border: none; background: none; color: #c0333a; cursor: pointer; font-size: 16px; flex: none; padding: 4px 6px; }
.st-del:hover { opacity: .7; }
.st-sys { font-size: 10px; color: #b3bcc2; flex: none; }
.st-preview { flex: none; display: inline-flex; align-items: center; min-width: 84px; }
.btn-add { display: inline-flex; align-items: center; gap: 6px; padding: 11px 16px; border: none; background: none;
  color: var(--accent); font-size: 15px; cursor: pointer; width: 100%; text-align: left; font-family: inherit; }
.btn-add:hover { background: #f7f9fa; }

/* ============ カルテ雛形（3スロット） ============ */
.karte-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; max-width: 860px; }
.karte-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 11px; }
/* A4横のサムネ（297:210・コンパクト用に高さ控えめ） */
.karte-thumb { aspect-ratio: 297 / 210; width: 100%; max-height: 130px; background: #fff; border: 1px solid #d8dee2;
  border-radius: 6px; background-repeat: repeat; background-position: 0 0; box-shadow: inset 0 0 0 1px #fff; }
.karte-thumb.grid_s { background-image:
  linear-gradient(#e0e6ea 1px, transparent 1px), linear-gradient(90deg, #e0e6ea 1px, transparent 1px);
  background-size: 13px 13px; }
.karte-thumb.grid_l { background-image:
  linear-gradient(#dbe2e7 1px, transparent 1px), linear-gradient(90deg, #dbe2e7 1px, transparent 1px);
  background-size: 30px 30px; }
.karte-thumb.image { background-size: cover; background-position: center; }
.karte-title { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px;
  font-size: 14px; font-weight: 600; margin: 8px 0 5px; font-family: inherit; box-sizing: border-box; }
.karte-title:focus { outline: none; border-color: var(--accent); }
.karte-sub { font-size: 11px; color: var(--muted); margin: 0 0 5px; }
.karte-presets { display: flex; gap: 5px; margin-bottom: 5px; }
.preset-btn { flex: 1; padding: 5px 3px; border: 1px solid var(--line); border-radius: 7px; background: #fff;
  font-size: 11px; cursor: pointer; color: var(--muted); font-family: inherit; }
.preset-btn:hover { background: var(--accent-soft); }
.preset-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.karte-import { display: flex; gap: 5px; margin-bottom: 5px; }
.import-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  padding: 6px 3px; border: 1px solid var(--line); border-radius: 7px; background: #fff; font-size: 11px;
  cursor: pointer; color: var(--ink); font-family: inherit; }
.import-btn:hover { background: #f5f8fa; }
.import-btn.pro { color: #aab4ba; cursor: default; }
.import-btn.pro:hover { background: #fff; }
.import-btn input { display: none; }
.karte-clear { width: 100%; padding: 6px; border: 1px dashed var(--line); border-radius: 7px; background: #fff;
  color: var(--muted); font-size: 11px; cursor: pointer; font-family: inherit; }
.karte-clear:hover { background: #fbfbfb; color: #c0333a; border-color: #e6b3b3; }
.karte-card.add { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 6px;
  color: #aab4ba; border-style: dashed; cursor: default; }
.karte-card.add .plus { font-size: 34px; line-height: 1; }
/* Pro枠（カルテ4・5）＝プレビューにPROバッジ */
.karte-thumb.pro-thumb { display: flex; align-items: center; justify-content: center; background: #faf7ff; border-style: dashed; }
.karte-name-static { font-size: 14px; font-weight: 600; color: var(--muted); margin: 8px 0 3px; }

/* ============ モーダル（テンプレ選択など） ============ */
.modal-back { position: fixed; inset: 0; background: rgba(20,30,36,.45); display: flex; align-items: center;
  justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: 14px; padding: 22px; max-width: 720px; width: 92%; }
/* 写真の全画面表示（画像のみ・メモなし） */
.photo-full { position: fixed; inset: 0; z-index: 110; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; }
.photo-full-img { max-width: 100vw; max-height: 100vh; object-fit: contain; }
.photo-full-bar { position: fixed; top: 14px; right: 14px; display: flex; gap: 10px; z-index: 111; }
.photo-full-bar .btn { box-shadow: 0 2px 10px rgba(0,0,0,.3); }
.modal h3 { margin: 0 0 4px; font-size: 17px; }
.modal .sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.tpl-pick { display: flex; gap: 14px; flex-wrap: wrap; }
.tpl-opt { flex: 1 1 180px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; cursor: pointer; text-align: center; }
.tpl-opt:hover { border-color: var(--accent); background: var(--accent-soft); }
.tpl-opt .karte-thumb { margin-bottom: 8px; }
.tpl-opt .nm { font-size: 14px; font-weight: 600; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.btn { padding: 9px 16px; border-radius: 9px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 14px; font-family: inherit; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn:hover { opacity: .9; }

/* カルテ一覧のサムネ（顧客詳細） */
.chart-thumb { width: 64px; height: 45px; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; background: #fff; vertical-align: middle; }

/* ============ カルテ編集エディタ ============ */
.editor-body { position: fixed; inset: 0; display: flex; flex-direction: column; background: #eef1f3; }
.editor-top { display: flex; align-items: center; gap: 14px; padding: 8px 14px; background: #23323b; color: #fff; }
.editor-top .e-title { font-size: 14px; font-weight: 600; }
.editor-top .e-title small { color: #9fb2bd; font-weight: 400; }
.editor-top .spacer { flex: 1; }
.editor-top .e-status { font-size: 12px; color: #9fe6c0; }
.e-tool-back { color: #cdd8de; font-size: 13px; text-decoration: none; }
/* 本体：左レール＋キャンバスの横並び */
.editor-main { flex: 1; display: flex; min-height: 0; }
/* 道具レール（左・縦並び） */
/*  2026-08-20：コンパクト化＝2列・文字と部品を小さく。
    ※アイコンは絵文字のまま（将来デザインを揃えて作り直す）。 */
.editor-tools { width: 152px; flex: none; display: flex; flex-direction: column; align-items: stretch; gap: 0;
  padding: 3px 8px; background: #fff; border-right: 1px solid var(--line); overflow-y: auto; }
.tgrp { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 6px 0;
  border-bottom: 1px solid var(--line); }
.tgrp:last-child { border-bottom: none; }
.tgrp .gl { font-size: 9px; color: var(--muted); line-height: 1.2; }
.trow { display: flex; gap: 4px; }
/* 色パレット＝1行5個。左右の端がボタン類のツラにそろうように、間隔で調整する。
   （ペン＝既定5＋空き5で10個＝2行／蛍光＝既定3＋空き2で5個＝1行） */
.trow.swatches { display: grid; grid-template-columns: repeat(5, 22px);
  justify-content: space-between; row-gap: 7px; padding: 2px 0; }
.tbtn { min-width: 28px; height: 28px; padding: 0 5px; border: 1px solid var(--line); border-radius: 7px; background: #fff;
  cursor: pointer; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  font-family: inherit; color: var(--ink); white-space: nowrap; overflow: hidden; }
/* 道具は2列に並べる */
.tgrp.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.tgrp.tools .tbtn { justify-content: center; padding: 0 3px; font-size: 10.5px; letter-spacing: -.02em; }
.tgrp.wide2 { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.trow .tbtn { flex: 1; min-width: 0; padding: 0; font-size: 11px; }
.tbtn:hover { background: #f2f6f8; }
.tbtn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tbtn:disabled { opacity: .4; cursor: default; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch.active { box-shadow: 0 0 0 2px var(--accent); transform: scale(1.12); }
/* 空きスロット＝押すと色を選べる。斜線で「まだ空」と分かるように */
.swatch.empty { background: repeating-linear-gradient(45deg, #fff, #fff 3px, #dfe5ea 3px, #dfe5ea 6px); }
.swatch.custom { position: relative; }
.swatch.custom::after { content: ''; position: absolute; right: -1px; bottom: -1px; width: 6px; height: 6px;
  border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.wbtn .dot { display: inline-block; border-radius: 50%; background: #333; }
.pro-note { font-size: 10px; color: var(--muted); }
/* 太さスライダー（確認用・数値表示つき） */
.wslider-row { display: flex; align-items: center; gap: 8px; }
.wslider-row #wslider { flex: 1; min-width: 0; }
.wslider-row .wval { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; width: 40px; text-align: right; flex: none; }
.pro-pill { font-size: 9px; background: #f3e9ff; color: #8a3ffc; padding: 1px 5px; border-radius: 10px; margin-left: 3px; }

/* カルテ編集画面では、ブラウザの文字列選択・長押しメニューを全面的に止める。
   ペンで書いたときに、用紙だけでなく「画面コード」など用紙の外の文字まで選択されてしまうため。
   ※入力欄と文字オブジェクト（.text-obj）だけは選択できるように下で戻している。
   ※他の画面（顧客一覧など）は従来どおり文字をコピーできる。 */
body.editor-body { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: manipulation; }   /* ダブルタップ拡大を止める（短い2画を素早く打つと誤作動するため） */
body.editor-body input, body.editor-body textarea, body.editor-body select,
body.editor-body [contenteditable="true"] { user-select: text; -webkit-user-select: text; -webkit-touch-callout: default; }
/* Apple Pencil の案内バー（初回だけ・カルテ編集の下部） */
.pencil-hint { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 180;
  display: flex; align-items: center; gap: 12px; background: #fff7e6; border: 1px solid #f0d9a8;
  border-radius: 12px; padding: 10px 14px; font-size: 13px; line-height: 1.6; color: #6b4e16;
  box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.pencil-hint span { flex: 1; min-width: 0; }
.pencil-hint .btn { flex: none; }

/* カルテ編集の上部バーに出す版数（タップで更新ダイアログ） */
.e-ver { font-size: 11px; color: #8aa0ac; margin-right: 10px; cursor: pointer;
  text-decoration: underline dotted #8aa0ac; text-underline-offset: 2px; flex: none; }
.e-ver:hover { color: #2f8fbf; }
.editor-canvas-wrap { flex: 1; min-width: 0; position: relative; overflow: hidden; background: #eef1f3; touch-action: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#paper { position: absolute; top: 0; left: 0; transform-origin: 0 0; background: #fff; box-shadow: 0 4px 20px rgba(0,0,0,.15); flex: none; touch-action: none; overflow: hidden;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
/* ズーム操作バー（キャンバス右下） */
.zoombar { position: absolute; right: 14px; bottom: 14px; display: flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: 10px; padding: 4px 6px;
  box-shadow: 0 2px 10px rgba(0,0,0,.12); z-index: 100; }
.zbtn { min-width: 30px; height: 30px; border: 1px solid var(--line); background: #fff; border-radius: 7px; cursor: pointer;
  font-size: 15px; color: var(--ink); font-family: inherit; display: inline-flex; align-items: center; justify-content: center; }
.zbtn.wide { padding: 0 10px; font-size: 12px; }
.zbtn:hover { background: #f2f6f8; }
.zlabel { font-size: 12px; color: var(--muted); min-width: 46px; text-align: center; }
#paper .layer { position: absolute; inset: 0; touch-action: none; }
/* ★重なり順はここで決まる（DOMの並びだけでは効かない）。
   下→上：①下地 ②写真＋B/A枠 ③蛍光 ④手書き ⑤図形 ⑥文字 ⑦足元の情報
   ※④⑤は同じ「筆記」レベル。手書きは1枚の絵なので、図形と1画ずつ交互に
     重ねることはできない。図形は手書きの上に置く（2026-08-20 みや指示）。 */
#bg { z-index: 0; }
#photoLayer { z-index: 10; }
#hlCanvas { z-index: 20; }
#penCanvas { z-index: 30; }
#shapeLayer { z-index: 40; }
#textLayer { z-index: 50; }
#footLayer { z-index: 60; }
#uiLayer { z-index: 70; pointer-events: none; }
#overlay { z-index: 80; }
#bg.grid_s { background-image: linear-gradient(#e0e6ea 1px, transparent 1px), linear-gradient(90deg,#e0e6ea 1px, transparent 1px); }
#bg.grid_l { background-image: linear-gradient(#dbe2e7 1px, transparent 1px), linear-gradient(90deg,#dbe2e7 1px, transparent 1px); }
#bg.image { background-size: cover; background-position: center; }
/* レイヤーは透過し、選択モード時だけオブジェクトが当たり判定を持つ（写真の再選択バグ対策） */
.photo-obj, .text-obj, .frame-obj { pointer-events: none; }
#paper.sel-mode .photo-obj, #paper.sel-mode .text-obj, #paper.sel-mode .frame-obj { pointer-events: auto; }
.photo-obj { position: absolute; }
/* B/A枠（パーツ）：外枠・上部見出し(塗り+白抜き)・中央線。色/線幅は inline（＝選択ペン色・FRAME_LW） */
.frame-obj { position: absolute; box-sizing: border-box; background: transparent; }
.frame-obj .fr-hdr { position: absolute; left: 0; right: 0; top: 0; box-sizing: border-box;
  display: flex; align-items: center; justify-content: center; font-weight: 700; line-height: 1; }
.frame-obj .fr-lbl { flex: 1; display: flex; align-items: center; justify-content: center; line-height: 1;
  white-space: nowrap; min-width: 0; cursor: text; }
/* 見出しは書き換えられる（ダブルタップ）。編集中はうっすら枠を出す */
.frame-obj .fr-lbl.editing { outline: 1px dashed rgba(255,255,255,.85); outline-offset: 2px; }
/* 上下型は1バーに1つ＝バー全体でセンター */
.frame-obj .fr-hdr:not(.fr-hdr-2) .fr-lbl { flex: 1; }
.frame-obj .fr-vline { position: absolute; left: 50%; top: 0; bottom: 0; }
.frame-obj .fr-hline { position: absolute; top: 50%; left: 0; right: 0; }
/* B/A枠のグリッド（比較用）。各セル(Before/After)の写真エリアに SVG で比率配置＝左右上下で完全一致 */
.frame-obj .fr-grid { position: absolute; inset: 0; pointer-events: none; }
.frame-obj .fr-gcell { position: absolute; overflow: visible; }
.frame-obj .fr-gcell line { stroke: var(--fr-grid-color, rgba(40,60,70,.22)); stroke-width: 1; vector-effect: non-scaling-stroke; }
/* 重なり順：セル画像(0) < グリッド(1) < バー/縦線(2) < セル操作(4) < 選択ハンドル(5) */
.frame-obj .fr-grid { z-index: 1; }
.frame-obj .fr-hdr, .frame-obj .fr-vline, .frame-obj .fr-hline { z-index: 2; }
/* B/A枠：セル画像（各セルが画像の窓） */
/* 余白の色。画像を枠より小さくしたときに見える（2026-08-21）。※将来 業種別に選べる設定にする案あり */
.frame-obj .fr-cell { position: absolute; overflow: hidden; z-index: 0; background: #fff; }
.frame-obj .fr-img { position: absolute; max-width: none; height: auto; user-select: none; -webkit-user-drag: none; touch-action: none; }
.frame-obj .fr-add { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  border: 1px dashed #9aa7ae; background: rgba(255,255,255,.85); color: #6a767c;
  border-radius: 8px; padding: 6px 12px; font-size: 13px; cursor: pointer; font-family: inherit; white-space: nowrap; }
.frame-obj .fr-cell-ctrl { position: absolute; left: 6px; right: 6px; bottom: 6px; display: none; align-items: center; gap: 8px;
  background: rgba(255,255,255,.92); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; z-index: 4; }
.frame-obj.selected .fr-cell-ctrl { display: flex; }
.frame-obj .fr-zoom { flex: 1; min-width: 0; }
.frame-obj .fr-clear { flex: none; border: none; background: none; cursor: pointer; font-size: 15px; line-height: 1; padding: 0; }
/* B/A枠 作成ダイアログ */
.fd-row { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.fd-row .fd-lb { width: 7em; flex: none; color: var(--muted); font-size: 13px; }
.fd-sws { display: flex; gap: 8px; flex-wrap: wrap; }
.fd-sw { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.fd-sw.on { border-color: var(--ink); box-shadow: 0 0 0 2px #fff inset; }
.fd-preview { margin: 8px 0 4px; border: 1px solid var(--line); border-radius: 8px; background: #eef2f5; padding: 10px; height: 150px; display: flex; align-items: center; justify-content: center; }
.fd-preview svg { max-height: 100%; }
.photo-obj img { width: 100%; height: 100%; display: block; user-select: none; -webkit-user-drag: none; }
.text-obj { position: absolute; min-width: 20px; color: #1a1a1a; line-height: 1.3; outline: none; white-space: pre-wrap;
  cursor: text; padding: 2px 3px;
  user-select: text; -webkit-user-select: text; -webkit-touch-callout: default; }
.obj-handles { position: absolute; border: 1.5px solid var(--accent); pointer-events: none; }
.obj-handle { position: absolute; width: 12px; height: 12px; background: #fff; border: 1.5px solid var(--accent); border-radius: 3px;
  pointer-events: auto; }
.obj-handle.br { right: -7px; bottom: -7px; cursor: nwse-resize; }
.obj-del { position: absolute; right: -10px; top: -12px; width: 22px; height: 22px; border-radius: 50%; background: #c0333a;
  color: #fff; border: none; cursor: pointer; font-size: 12px; pointer-events: auto; line-height: 1; }
.sel-rect { position: absolute; border: 1.5px dashed var(--accent); background: rgba(47,143,191,.1); pointer-events: none; }
/* 写真の「✂ トリミング」ボタン（左上・削除×の対角） */
.obj-crop { position: absolute; left: -10px; top: -12px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent);
  color: #fff; border: none; cursor: pointer; font-size: 12px; pointer-events: auto; line-height: 1; z-index: 2; }
/* B/A枠のグリッドON/OFFボタン（左下）。ONでアクセント塗り */
.obj-grid { position: absolute; left: -10px; bottom: -12px; width: 22px; height: 22px; border-radius: 50%; background: #fff;
  color: #46525a; border: 1.5px solid var(--accent); cursor: pointer; font-size: 12px; pointer-events: auto; line-height: 1; z-index: 2; }
.obj-grid.on { background: var(--accent); color: #fff; border-color: var(--accent); }
/* 枠の選択ハンドル類はセル画像/バー/操作より前面に */
.frame-obj .obj-del, .frame-obj .obj-handle, .frame-obj .obj-grid { z-index: 5; }
/* トリミング中のオーバーレイ／枠／ハンドル／操作バー */
.crop-ov { position: absolute; inset: 0; z-index: 5; }
.crop-box { position: absolute; box-sizing: border-box; border: 1.5px solid #fff; box-shadow: 0 0 0 9999px rgba(0,0,0,.45); cursor: move; }
.crop-h { position: absolute; width: 16px; height: 16px; background: #fff; border: 1.5px solid var(--accent); border-radius: 3px; }
.crop-h.tl { left: -8px; top: -8px; cursor: nwse-resize; }
.crop-h.tr { right: -8px; top: -8px; cursor: nesw-resize; }
.crop-h.bl { left: -8px; bottom: -8px; cursor: nesw-resize; }
.crop-h.br { right: -8px; bottom: -8px; cursor: nwse-resize; }
.crop-bar { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; z-index: 100; }

/* ============ 入力フォーム（顧客登録・編集） ============ */
.form-max { max-width: 720px; }
.form-grid { display: grid; grid-template-columns: 150px 1fr; gap: 14px 16px; padding: 18px; align-items: center; }
.form-grid .fl { color: var(--muted); font-size: 14px; }
.form-grid .fl .req { color: #c0333a; font-size: 11px; margin-left: 4px; }
.form-grid .fi { display: flex; gap: 10px; }
.f-input, .f-select, .f-area { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--ink); box-sizing: border-box; }
.f-input:focus, .f-select:focus, .f-area:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.f-input.err { border-color: #e5484d; }
/* 読み取り専用フィールド（顧客コードなど＝編集不可） */
.f-readonly { background: #f4f6f8; color: var(--muted); cursor: default; }
.f-readonly:focus { box-shadow: none; border-color: var(--line); }
.f-half { display: flex; gap: 10px; }
.f-area { min-height: 70px; resize: vertical; }
.form-actions { display: flex; align-items: center; gap: 12px; margin: 14px 0 18px; }
.form-actions .spacer { flex: 1; }
.btn.danger { color: #c0333a; border-color: #e6b3b3; }
.btn.danger:hover { background: #fdeeee; }
.form-err { color: #c0333a; font-size: 13px; margin: 0 0 12px; display: none; }
/* 不具合報告 一覧（設定 → 不具合報告） */
.bug-list { display: flex; flex-direction: column; gap: 12px; }
.bug-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fff; }
.bug-card.done { background: #f6f8f9; opacity: .8; }
.bug-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.bug-badge { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 10px; }
.bug-badge.open { color: #c0333a; background: #fdeeee; }
.bug-badge.done { color: #1e9e5a; background: #e8f6ee; }
.bug-code { font-weight: 700; color: #46525a; letter-spacing: .03em; }
.bug-by { margin-left: auto; }
.bug-content { font-size: 14px; color: #22303a; line-height: 1.6; margin: 8px 0 6px; white-space: pre-wrap; }
.bug-url { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bug-actions { display: flex; gap: 8px; margin-top: 10px; }
/* 不具合報告バー（全画面 右上） */
.bugbar { position: fixed; top: 10px; right: 14px; z-index: 150; display: flex; align-items: center; gap: 6px; }
.bugbar.on-editor { top: 64px; }   /* カルテ編集は上部に保存ボタンがあるので下げる */
.bugbar-code { font-size: 11px; font-weight: 700; color: #fff; background: rgba(20,30,36,.5);
  padding: 3px 9px; border-radius: 10px; letter-spacing: .04em; }
.bugbar-btn { font-size: 12px; padding: 4px 11px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; box-shadow: 0 1px 5px rgba(0,0,0,.14); font-family: inherit; }
.bugbar-btn:hover { background: #f2f6f8; }
.bug-meta { font-size: 13px; display: flex; flex-direction: column; gap: 4px;
  background: #f6f8f9; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
.bug-meta .k { display: inline-block; width: 4.5em; color: var(--muted); }
/* 顧客数の上限ヒント（顧客一覧） */
.cust-limit { color: var(--muted); }
.cust-limit.over { color: #c0333a; font-weight: 700; }
/* プラン選択（demo.html） */
.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.plan-card { text-align: left; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fff; cursor: pointer; display: flex; flex-direction: column; gap: 6px; font-family: inherit; }
.plan-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.plan-card.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.plan-head { display: flex; align-items: center; gap: 8px; }
.plan-ico { font-size: 20px; }
.plan-name { font-size: 15px; font-weight: 700; color: var(--ink); }
.plan-cur { margin-left: auto; font-size: 11px; font-weight: 700; color: #fff; background: var(--accent); padding: 2px 8px; border-radius: 10px; }
.plan-desc { font-size: 12px; color: var(--muted); line-height: 1.6; }
/* 近日公開プラン（Pro/Business）＝グレーアウト */
.plan-card.coming { background: #f3f5f6; opacity: .7; cursor: default; }
.plan-card.coming:hover { border-color: var(--line); background: #f3f5f6; box-shadow: none; }
.plan-card.coming .plan-name, .plan-card.coming .plan-desc { color: #9aa7ae; }
.plan-soon { margin-left: auto; font-size: 11px; font-weight: 700; color: #8a3ffc; background: #f0e9ff; padding: 2px 8px; border-radius: 10px; }
/* デモ以外でグレーにするパネル（サンプル生成部） */
.panel-disabled { opacity: .55; pointer-events: none; }
/* 初期設定モーダル */
.setup-fields { display: flex; flex-direction: column; gap: 12px; margin: 4px 0 14px; }
.setup-f { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.setup-f .req { color: #c0333a; font-size: 11px; margin-left: 4px; }
.setup-f .f-input { font-size: 15px; }
.toggle-row { display: inline-flex; align-items: center; gap: 8px; }

/* 予約フォーム：施術項目チェックリスト */
.svc-list { display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; max-height: 240px; overflow-y: auto; }
.svc-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.svc-item:hover { background: #f5f8fa; }
.svc-item input { width: 17px; height: 17px; }
.svc-item .nm { flex: 1; font-size: 14px; }
.svc-item .pr { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.svc-item .cat { font-size: 11px; color: #aab4ba; }
.amount-box { display: flex; align-items: center; gap: 8px; }
.amount-box .yen { font-size: 18px; color: var(--muted); }
.amount-box input { font-size: 18px; font-weight: 600; width: 140px; text-align: right; }
/* 予約フォーム：フル幅・1行4項目＋左右2カラム */
.form-wide { width: 100%; }
.af { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.af-lb { font-size: 12px; color: var(--muted); }
.af-row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 16px; padding: 10px 18px 6px; }
/* iOS Safari の日付/時刻入力は最小幅が大きく列を押し広げるため、子を縮められるように */
.af-row4 > .af { min-width: 0; }
.af-row4 .f-input, .af-row4 .f-select { min-width: 0; width: 100%; box-sizing: border-box; }
/* ステータスのselectだけ天地を広げる（日付/時刻の高さに合わせる） */
.af-status { padding-block: 12px; }
/* 顧客ヘッダー（予約内容に統合）：顧客コード・氏名・よみ/ニックネーム */
.cust-head { padding: 4px 18px 4px; }
.cust-line { display: flex; align-items: center; gap: 8px; }
.cust-main { display: flex; align-items: baseline; gap: 12px; flex: 1; flex-wrap: wrap; }
.cust-no { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cust-nm { font-size: 18px; font-weight: 700; color: var(--ink); }
.cust-sub { font-size: 13px; color: var(--muted); }
.cust-clickable { cursor: pointer; border-radius: 8px; padding: 6px 8px; margin: -4px -8px; }
.cust-clickable:hover { background: var(--accent-soft); }
.cust-go { font-size: 22px; color: var(--muted); line-height: 1; flex: none; }
.cust-clickable:hover .cust-go { color: var(--accent); }
.af-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 6px 18px 4px; align-items: stretch; }
.af-row2 .af-col { display: flex; flex-direction: column; gap: 6px; }
/* 無料版：施術メニュー（5件＋選ばない=6行）と施術詳細を同じ固定高に */
#svc-area { height: 235px; }
.af-detail { resize: vertical; height: 235px; }
/* Pro版：同じ固定高の枠に カテゴリselect＋枠内スクロールのラジオ */
.svc-pro { display: flex; flex-direction: column; gap: 6px; height: 100%; }
.svc-pro .svc-cat { flex: none; }
.svc-scroll { flex: 1; min-height: 0; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px; display: flex; flex-direction: column; gap: 5px; }
.af-amount-row { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 6px 18px 10px; }
/* 施術メニュー：縦のラジオリスト（1つ選択） */
.svc-radios { display: flex; flex-direction: column; gap: 5px; }
.svc-radio { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 11px; cursor: pointer; font-size: 14px; color: var(--ink); background: #fff; }
.svc-radio input { width: 16px; height: 16px; flex: none; }
.svc-radio .nm { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.svc-radio .pr { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; flex: none; }
.svc-radio.on { border-color: var(--accent); background: var(--accent-soft); }
/* 顧客検索サジェスト */
.cust-pick { position: relative; }
.cust-sug { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px;
  margin-top: 4px; box-shadow: 0 6px 20px rgba(0,0,0,.12); z-index: 200; max-height: 240px; overflow-y: auto; display: none; }
/* 検索候補がパネルのはみ出しクリップで隠れないように */
.panel.overflow-ok { overflow: visible; }
.cust-sug .s-row { padding: 9px 12px; cursor: pointer; font-size: 14px; }
.cust-sug .s-row:hover { background: var(--accent-soft); }
.cust-chosen { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; }
.cust-chosen .chg { font-size: 12px; color: var(--accent); cursor: pointer; font-weight: 400; }

/* ============ カレンダー（ダッシュボード） ============ */
.cal-head { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 12px; }
.cal-head strong { font-size: 15px; min-width: 130px; text-align: center; }
.cal-nav { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; font-size: 16px; }
.cal-nav:hover { background: #f2f6f8; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.cal-dow { background: #fafbfc; text-align: center; padding: 7px 0; font-size: 12px; color: var(--muted); font-weight: 600; }
.cal-cell { background: #fff; min-height: 60px; padding: 5px 6px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
.cal-cell:hover { background: #eef6fa; }
.cal-cell.other { background: #fafbfc; }
.cal-cell.other .d { color: #cbd3d8; }
.cal-cell.today { background: var(--accent-soft); }
.cal-cell.today .d { color: var(--accent); font-weight: 700; }
.cal-cell .d { font-size: 12px; font-variant-numeric: tabular-nums; }
.cal-cell.sun .d { color: #d64545; }
.cal-cell.sat .d { color: #2f6fe0; }
.cal-cell .cnt { align-self: flex-start; font-size: 11px; background: var(--accent); color: #fff; border-radius: 12px; padding: 1px 8px; }
.cal-cell .cnt.zero { display: none; }

/* ダッシュボードの予約一覧（3列・各2行・左右padding 1em） */
.appts-tbl td { padding-left: 1em; padding-right: 1em; }
.appts-tbl .badge { font-size: 9px; padding: 1px 6px; }
.status-cell:hover { opacity: .8; }
/* ステータス変更メニュー */
.status-menu { position: fixed; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15); padding: 4px; z-index: 320; }
.status-menu .sm-row { padding: 7px 12px; cursor: pointer; border-radius: 7px; }
.status-menu .sm-row:hover { background: var(--accent-soft); }
.status-menu .sm-row.cur { background: #eef2f4; }
/* キャンセル/無断キャの行はグレーに（時間も含めて統一） */
.row-canceled { background: #eef1f4; }
.row-canceled td, .row-canceled strong, .row-canceled .time, .row-canceled .cell-main { color: #7f8b94; }
.row-canceled strong { font-weight: 600; }

/* ダッシュボード：一覧だけ枠内スクロール、他（サマリ/検索/カレンダー）は固定 */
.main-dash { display: flex; flex-direction: column; overflow: hidden; }
.main-dash .dash-cols { flex: 1; min-height: 0; align-items: stretch; margin-bottom: 0; }
.main-dash .cal-col { align-self: flex-start; }
.main-dash .list-col { display: flex; flex-direction: column; min-height: 0; margin-bottom: 0; }
.main-dash .list-col > h2 { flex: none; }
.main-dash .list-col #appts { flex: 1; overflow-y: auto; min-height: 0; }
@media (max-width: 980px) {
  .main-dash { display: block; overflow-y: auto; }
  .main-dash .list-col #appts { overflow: visible; }
}

/* ダッシュボードの2カラム（左1/3カレンダー・右2/3一覧） */
.dash-cols { display: flex; gap: 18px; align-items: flex-start; }
.dash-cols .cal-col { flex: 1 1 300px; min-width: 290px; }
.dash-cols .list-col { flex: 2 1 440px; }
.dash-cols .cal-col .cal-cell { min-height: 46px; padding: 4px 4px; }
.dash-cols .cal-col .cal-head strong { min-width: 100px; font-size: 14px; }
.dash-cols .cal-col .cnt { font-size: 10px; padding: 0 6px; }
@media (max-width: 980px) {
  .dash-cols { flex-direction: column; }
  .dash-cols .cal-col, .dash-cols .list-col { width: 100%; flex-basis: auto; }
}

/* 予約一覧のフィルタ */
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: none; background: #fff; padding: 8px 14px; font-size: 13px; cursor: pointer; font-family: inherit; color: var(--muted); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: none; }
.seg button.active { background: var(--accent); color: #fff; }

/* ============ 顧客売上分析 ============ */
.anl-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 900px) { .anl-cols { grid-template-columns: 1fr; } }

/* 横棒グラフ */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-lb { flex: none; width: 76px; font-size: 13px; color: var(--muted); }
.bar-track { flex: 1; height: 14px; background: #eef2f5; border-radius: 7px; overflow: hidden; }
.bar-track.inline { display: inline-block; width: 130px; vertical-align: middle; height: 10px; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 7px; min-width: 2px; }
.bar-val { flex: none; width: 92px; text-align: right; font-size: 12px; color: var(--muted);
  font-variant-numeric: tabular-nums; }
.bar-val.inline { width: auto; margin-left: 8px; }
.bar-val b { color: var(--ink); font-weight: 700; }
.bar-pct { display: inline-block; width: 40px; text-align: right; }

/* 定休日の曜日チェック（設定画面） */
.dow-row { display: flex; gap: 6px; }
.dow { position: relative; cursor: pointer; }
.dow input { position: absolute; opacity: 0; width: 0; height: 0; }
.dow span { display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; color: var(--muted); background: #fff; }
.dow input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }

/* ============ 予約：時間帯ビュー（1週間） ============ */
.wknav { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex: none; }
.wknav strong { font-size: 15px; }
.main-appts > #weekPanel { flex: 1; min-height: 0; overflow: auto; margin-bottom: 0; padding: 0; }

.wk-grid { display: grid; grid-template-columns: 52px repeat(7, minmax(92px, 1fr)); min-width: 696px; }
.wk-axis, .wk-col { border-left: 1px solid var(--line); }
.wk-axis { border-left: 0; }

.wk-head { height: 46px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; border-bottom: 1px solid var(--line); background: #fafbfc;
  position: sticky; top: 0; z-index: 3; }
.wk-dow { font-size: 11px; color: var(--muted); }
.wk-date { font-size: 14px; font-weight: 700; line-height: 1.1; }
.wk-cnt, .wk-off { font-size: 10px; color: var(--muted); }
.wk-off { color: #b06a6a; font-weight: 700; }
.wk-col.is-today .wk-head { background: var(--accent-soft); }
.wk-col.is-today .wk-date { color: var(--accent); }
.wk-col.is-closed { background: repeating-linear-gradient(45deg, #fafbfc, #fafbfc 6px, #f2f4f6 6px, #f2f4f6 12px); }

.wk-body { position: relative; margin-top: 9px; }   /* 先頭の時刻ラベルが上で切れないように */
.wk-tick { position: absolute; right: 6px; transform: translateY(-50%);
  font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.wk-axis .wk-body { border-right: 1px solid var(--line); }

/* 空き枠：ふだんは薄く、マウスを乗せると「＋」が出る */
.wk-slot { position: absolute; left: 2px; right: 2px; border-radius: 4px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: transparent; border-top: 1px dotted #e8ecef; }
.wk-slot:hover { background: var(--accent-soft); color: var(--accent); font-weight: 700; }

/* 予約の帯 */
.wk-appt { position: absolute; border-radius: 5px; padding: 3px 5px; overflow: hidden; cursor: pointer;
  font-size: 11px; line-height: 1.25; }
.wk-appt:hover { filter: brightness(0.97); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.wk-appt.is-cancel { opacity: .5; text-decoration: line-through; }
.wk-t { font-weight: 700; font-variant-numeric: tabular-nums; }
.wk-n { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-s { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============ カルテ：図形（四角・丸・矢印） ============ */
#shapeLayer { pointer-events: none; }
#shapeLayer .shape-obj { pointer-events: auto; }
.shape-obj { position: absolute; }
.shape-obj svg { width: 100%; height: 100%; display: block; overflow: visible; }
.shape-obj.ghost { pointer-events: none; opacity: .7; }
.shape-obj.selected { outline: 1px dashed var(--accent); outline-offset: 2px; }

/* ============ カルテの足元（システムが自動で入れる情報） ============ */
#footLayer { pointer-events: none; }
.kfoot { position: absolute; bottom: 1.8%; color: var(--muted); line-height: 1.35; white-space: nowrap; }
.kfoot-l { left: 1.8%; }
.kfoot-r { right: 1.8%; text-align: right; }

/* 選択中のオブジェクトの色・太さを映しているあいだの見た目（借りているのが分かるように） */
/* 借りている状態の色付け。左右にpaddingを足すと色玉のツラがずれるので、外側へ広げる */
.tgrp.obj-edit { background: var(--accent-soft); border-radius: 8px;
  margin-left: -6px; margin-right: -6px; padding-left: 6px; padding-right: 6px; }
.tgrp.obj-edit .gl { color: var(--accent); font-weight: 700; }

/* B/A枠：左右そろえて調整するバー（枠の下・枠を選んでいるときだけ出る） */
.frame-obj .fr-pair { position: absolute; left: 0; right: 0; top: 100%; margin-top: 6px;
  display: none; align-items: center; gap: 10px; padding: 5px 10px;
  background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08); z-index: 5; }
.frame-obj.selected .fr-pair { display: flex; }
.frame-obj .fr-pair-cb { display: flex; align-items: center; gap: 5px; font-size: 11px;
  color: var(--muted); white-space: nowrap; cursor: pointer; }
.frame-obj .fr-pair.on .fr-pair-cb { color: var(--accent); font-weight: 700; }
.frame-obj .fr-pair-zoom { flex: 1; min-width: 0; }
.frame-obj .fr-pair-zoom:disabled { opacity: .35; }

/* 写真の取り込み先を選ぶメニュー（カメラ／写真／ファイル） */
.photo-src-menu { position: fixed; z-index: 320; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.16); padding: 6px; min-width: 172px; }
.photo-src-menu .ps-row { display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 10px; border: 0; background: none; border-radius: 7px; cursor: pointer;
  font-size: 13px; font-family: inherit; color: var(--ink); text-align: left; }
.photo-src-menu .ps-row:hover { background: var(--accent-soft); }
.photo-src-menu .ps-ico { font-size: 15px; width: 20px; text-align: center; }
