/* 香りノート 管理画面 — デザインB（ホワイト × ピンク）
   配色は kaori-note.jp のピンク見出し・予約ボタン・こげ茶の文字から取っている。
   ピンクは「押せるもの」と「選んでいる所」に使い、未読・返信待ちはそれより濃いピンクで出す。 */
:root {
  color-scheme: light;

  --bg: #ffffff;
  --surface: #ffffff;
  --surface-soft: #fff9fb;     /* カード */
  --surface-sunk: #fdf3f6;     /* 表の見出し・入力欄の沈め */
  --hover: #fdeef3;

  --ink: #4c3a26;              /* HPのこげ茶 */
  --ink-2: #7a6857;
  --ink-3: #a8998a;

  --line: #f6e1e8;
  --line-strong: #ecc9d5;

  --pink: #e8698c;             /* HPの予約ボタン */
  --pink-deep: #c24f73;        /* 文字色として読める濃さ */
  --pink-weak: #fdeef3;

  --ok: #3d7a52;   --ok-bg: #eaf6ee;
  --warn: #9a6b12; --warn-bg: #fdf3dc;
  --danger: #c0392b;

  --round: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  --mincho: "Shippori Mincho B1", "Hiragino Mincho ProN", "Yu Mincho", serif;

  --t-xs: 11.5px; --t-s: 13px; --t-m: 15px; --t-l: 18px; --t-xl: 24px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;

  --r: 20px;          /* カード */
  --r-s: 12px;        /* 入力欄・行 */
  --pill: 999px;
  --shadow: 0 6px 18px -12px rgba(232, 105, 140, .5);
  --tap: 44px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--round); font-size: var(--t-s); line-height: 1.75;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
input, textarea, select, button { font-family: inherit; font-size: 16px; color: inherit; }
a { color: var(--pink-deep); text-underline-offset: 3px; }
h2, h3 { margin: 0; line-height: 1.5; font-weight: 700; text-wrap: balance; }
h2 { font-size: var(--t-l); }
h3 { font-size: var(--t-m); }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.eyebrow { font-size: var(--t-xs); color: var(--pink-deep); font-weight: 700; letter-spacing: .08em; }
.hairline { border: 0; border-top: 1px solid var(--line); margin: var(--s4) 0; }
:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.stack { display: flex; flex-direction: column; gap: var(--s4); }
.row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }

/* ---- 上部：ロゴとタブ ---- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner, .tabs, .page { max-width: 1200px; margin: 0 auto; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s4) var(--s1); }
.logo { display: flex; align-items: baseline; gap: var(--s2); }
.logo b { font-family: var(--mincho); font-size: 20px; letter-spacing: .06em; }
.logo span { font-size: var(--t-xs); color: var(--ink-3); letter-spacing: .12em; }
.logo-lg b { font-size: 30px; }
.who { display: flex; align-items: center; gap: var(--s2); }
.who-name { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; font-size: var(--t-s); }
.who-name small { color: var(--ink-3); font-size: var(--t-xs); }

.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; padding: 0 var(--s2); }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: none; position: relative; display: inline-flex; align-items: center; gap: 6px;
  min-height: var(--tap); padding: 0 var(--s4); text-decoration: none;
  color: var(--ink-2); font-size: 14px; border-radius: var(--r-s) var(--r-s) 0 0;
}
.tabs a:hover { color: var(--ink); background: var(--surface-soft); }
.tabs a[aria-current="page"] { color: var(--pink-deep); font-weight: 700; }
.tabs a[aria-current="page"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 4px;
  border-radius: 4px 4px 0 0; background: var(--pink);
}
.tab-n {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--pill); background: var(--pink); color: #fff; font-size: 10.5px; font-weight: 700;
}

.page { padding: var(--s5) var(--s4) var(--s6); }

/* ---- ボタン・入力 ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 38px; padding: 0 var(--s4); border-radius: var(--pill);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-size: var(--t-s); font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--hover); }
.btn-primary { background: var(--pink); border-color: var(--pink); color: #fff; font-weight: 700; }
.btn-primary:hover { background: var(--pink-deep); border-color: var(--pink-deep); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--hover); }
.btn-lg { min-height: 48px; padding: 0 var(--s5); font-size: var(--t-m); }
.btn-sm { min-height: 32px; padding: 0 var(--s3); font-size: var(--t-xs); }
.btn[aria-pressed="true"] { background: var(--pink-weak); border-color: var(--pink); color: var(--pink-deep); font-weight: 700; }
button[disabled], .btn[disabled] { opacity: .45; cursor: default; }

.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 8px var(--s3);
  border: 1px solid var(--line-strong); border-radius: var(--r-s);
  background: var(--surface); color: var(--ink);
}
.textarea { line-height: 1.7; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--pink); box-shadow: 0 0 0 3px var(--pink-weak); }

.notice { background: var(--surface-soft); border: 1px solid var(--line); border-radius: var(--r-s); padding: var(--s3) var(--s4); color: var(--ink-2); }
.notice-error { background: #fdecea; border-color: #f5c6c0; color: var(--danger); }

/* ---- ログイン ---- */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: var(--s5) var(--s4); background: linear-gradient(180deg, #fff 0%, var(--surface-soft) 100%); }
.login-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 28px; padding: var(--s6) var(--s5); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: var(--s4); text-align: center;
}
.login-card p { color: var(--ink-2); font-size: var(--t-s); line-height: 1.9; }
.login-card .btn { width: 100%; }

/* ---- カード・数字 ---- */
.card, .tile, .chart, .split-list, .split-detail > .stack, .week .day {
  background: var(--surface-soft); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
}
.card { padding: var(--s4); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--s3); margin-top: var(--s2); }
.tile { display: block; padding: var(--s3) var(--s4); color: inherit; text-decoration: none; }
.tile-link:hover { border-color: var(--line-strong); background: var(--hover); }
.tile-label { font-size: var(--t-xs); color: var(--ink-3); }
.tile-value { font-size: var(--t-xl); font-weight: 700; line-height: 1.35; }
.tile-alert { color: var(--pink-deep); }

/* ---- 表 ---- */
.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.tbl { width: 100%; border-collapse: collapse; font-size: var(--t-s); }
.tbl th { text-align: left; font-weight: 500; color: var(--ink-3); font-size: var(--t-xs); background: var(--surface-sunk); padding: 8px 12px; white-space: nowrap; }
.tbl td { border-top: 1px solid var(--line); padding: 9px 12px; vertical-align: middle; }
.tbl th.num, .tbl td.num { text-align: right; white-space: nowrap; }
.tbl tbody tr:hover td { background: var(--surface-soft); }
section > .tbl { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; border-collapse: separate; border-spacing: 0; }
section > .tbl tr:first-child td { border-top: 0; }

/* ---- 状態の丸いラベル（色だけに頼らず必ず文字で出す） ---- */
.badge {
  display: inline-block; font-size: var(--t-xs); font-weight: 700; padding: 1px 10px;
  border-radius: var(--pill); background: var(--surface-sunk); color: var(--ink-2); white-space: nowrap; line-height: 1.7; vertical-align: 1px;
}
.badge-alert, .badge-no_show, .badge-tentative { background: var(--pink-weak); color: var(--pink-deep); }
.badge-confirmed, .badge-booked { background: #eef3fb; color: #3b5f95; }
.badge-visited, .badge-repeat { background: var(--ok-bg); color: var(--ok); }
.badge-lead { background: var(--warn-bg); color: var(--warn); }
.badge-cancelled, .badge-lost { background: #f3f0ed; color: var(--ink-3); text-decoration: line-through; }

/* ---- 一覧＋詳細（メール・LINE） ---- */
.split { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: var(--s4); align-items: start; }
.split-list { padding: var(--s3); min-width: 0; }
.split-detail { min-width: 0; }
.split-detail > .stack { padding: var(--s4); }
.split-detail > p.muted { padding: var(--s5); text-align: center; }
.seg { display: flex; padding: 4px; background: var(--surface-sunk); border-radius: var(--pill); margin-bottom: var(--s3); }
.seg button { flex: 1; min-height: 34px; border: 0; background: transparent; border-radius: var(--pill); cursor: pointer; color: var(--ink-2); font-size: var(--t-s); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--pink-deep); font-weight: 700; box-shadow: var(--shadow); }
.items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.item { display: block; padding: var(--s2) var(--s3); border-radius: var(--r-s); color: inherit; text-decoration: none; }
.item:hover { background: var(--hover); }
.items li.is-current .item { background: var(--surface); box-shadow: inset 3px 0 0 var(--pink), var(--shadow); }
.item-sub { font-size: var(--t-xs); color: var(--ink-2); margin-top: 2px; }
.item-snippet { font-size: var(--t-xs); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back-mobile { display: none; }

.mails { display: flex; flex-direction: column; gap: var(--s3); }
.mail { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-s); padding: var(--s3) var(--s4); }
.mail-out { background: var(--pink-weak); border-color: var(--line-strong); margin-left: 8%; }
.mail-head { font-size: var(--t-xs); color: var(--ink-2); margin-bottom: var(--s2); }
.mail-body, .note { white-space: pre-wrap; word-break: break-word; font-family: var(--round); font-size: var(--t-s); margin: 0; }
.reply { display: flex; flex-direction: column; gap: var(--s2); padding-top: var(--s2); }

.chat { display: flex; flex-direction: column; gap: var(--s2); max-height: 60dvh; overflow-y: auto; padding: var(--s3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.bubble { max-width: 80%; display: flex; flex-direction: column; }
.bubble-in { align-self: flex-start; }
.bubble-out { align-self: flex-end; align-items: flex-end; }
.bubble-text { white-space: pre-wrap; word-break: break-word; padding: 8px 14px; border-radius: 18px; background: var(--surface-sunk); }
.bubble-in .bubble-text { border-bottom-left-radius: 4px; }
.bubble-out .bubble-text { background: var(--pink); color: #fff; border-bottom-right-radius: 4px; }
.bubble-meta { font-size: var(--t-xs); margin-top: 2px; }

.picker { position: relative; margin-top: var(--s2); }
.picker-list { list-style: none; margin: 4px 0 0; padding: 4px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-s); box-shadow: var(--shadow); }
.picker-list button { width: 100%; text-align: left; padding: 8px 10px; background: none; border: 0; border-radius: 8px; cursor: pointer; font-size: var(--t-s); }
.picker-list button:hover { background: var(--hover); }

/* ---- フォーム ---- */
.form { display: flex; flex-direction: column; gap: var(--s3); }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: var(--t-xs); color: var(--ink-2); font-weight: 500; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s3); }
.filters { gap: var(--s2); }
.filters .input, .filters .select { width: auto; flex: 1 1 150px; }

/* ---- 予約の週表示 ---- */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--s2); }
.week .day { padding: var(--s2); min-height: 170px; box-shadow: none; }
.week .day.is-today { background: var(--pink-weak); border-color: var(--line-strong); }
.day-head { font-size: var(--t-s); text-align: center; padding-bottom: 4px; }
.is-today .day-head { color: var(--pink-deep); }
.bk { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-s); padding: 8px 10px; margin-top: var(--s2); font-size: var(--t-s); box-shadow: var(--shadow); }
.bk-cancelled, .bk-no_show { opacity: .6; box-shadow: none; }
.bk-actions { gap: 4px; margin-top: 6px; }
.bk-actions .btn { min-height: 28px; padding: 0 10px; font-size: var(--t-xs); }

.kv { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 8px var(--s3); margin: 0; padding: var(--s4); background: var(--surface-soft); border: 1px solid var(--line); border-radius: var(--r); }
.kv dt { color: var(--ink-3); font-size: var(--t-xs); padding-top: 2px; }
.kv dd { margin: 0; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.plain li:last-child { border-bottom: 0; }

/* ---- グラフ ---- */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--s4); }
.chart { margin: 0; padding: var(--s3) var(--s4); }
.chart figcaption { margin-bottom: var(--s2); }
.chart-box { position: relative; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart .tick { font-size: 11px; fill: var(--ink-3); }
.chart .bar { fill: var(--pink); }
.chart .bar.is-hover { fill: var(--pink-deep); }
.tip { position: absolute; top: 0; transform: translateX(-50%); pointer-events: none; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-s); padding: 4px 10px; font-size: var(--t-xs); white-space: nowrap; box-shadow: var(--shadow); }

/* ---- ホーム ---- */
.greet { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: var(--s2); }
.greet h2 { font-size: var(--t-l); }


/* ---- 選択チップ（香りのタイプ・強さ・問診） ---- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 34px; padding: 0 14px; border-radius: var(--pill); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink-2); font-size: var(--t-s); cursor: pointer;
}
.chip:hover { background: var(--hover); }
.chip[aria-pressed="true"] { background: var(--pink); border-color: var(--pink); color: #fff; font-weight: 700; }
.badge-scent { background: var(--pink-weak); color: var(--pink-deep); }
.seg-inline { margin: 0; min-width: 160px; }

/* ---- カルテ・日報 ---- */
.karte, .report { display: flex; flex-direction: column; gap: var(--s2); }
.kv-label { font-size: var(--t-xs); color: var(--ink-3); font-weight: 700; }
.ai-box { background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-s); padding: var(--s2) var(--s3); }
.audio { display: flex; flex-direction: column; gap: 6px; }
.audio audio { width: 100%; max-width: 420px; height: 36px; }
details > summary { cursor: pointer; color: var(--pink-deep); font-size: var(--t-s); }
.interview { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-s); padding: var(--s2) var(--s3); }
.confirm { border-color: var(--pink); }

/* ---- シフト ---- */
.shifts { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.shift {
  text-align: left; border: 0; border-radius: var(--pill); background: #eaf6ee; color: var(--ok);
  font-size: var(--t-xs); padding: 3px 10px; cursor: pointer;
}
.shift:hover { background: #d9efdf; }
.bk-flags { display: flex; flex-wrap: wrap; gap: 4px; }
.bk-flags:empty { display: none; }

/* ---- スマホ ---- */
@media (max-width: 767px) {
  .who-name { display: none; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .split.has-detail .split-list { display: none; }
  .split:not(.has-detail) .split-detail { display: none; }
  .back-mobile { display: block; }
  .week { grid-template-columns: minmax(0, 1fr); }
  .week .day { min-height: 0; }
  .day-head { text-align: left; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-value { font-size: var(--t-l); }
  .mail-out { margin-left: 0; }
}
