/* 整体院・サロン編の共通部品。色と書体は theme-wood.css / theme-white.css が上書きする */
:root {
  --bg: #f7f5f1;
  --surface: #ffffff;
  --surface-2: #f3f0ea;
  --line: #e5e0d7;
  --text: #2b2723;
  --muted: #847c72;
  --accent: #6b5a45;
  --accent-ink: #ffffff;
  --accent-soft: #efe9df;
  --ok: #4f7a52;
  --warn: #b0782c;
  --danger: #a5463a;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(40, 30, 20, .05), 0 6px 20px rgba(40, 30, 20, .06);
  --font-body: "Noto Sans JP", system-ui, sans-serif;
  --font-head: "Noto Serif JP", serif;
  --font-latin: "Noto Serif JP", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }

/* ── ヘッダー ── */
.app-header { position: relative; padding: 22px 16px 0; }
.app-header .inner { max-width: 1100px; margin: 0 auto; }
.brand { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.brand-name { font-family: var(--font-latin); font-size: 26px; letter-spacing: .12em; margin: 0; font-weight: 500; }
.brand-sub { font-size: 13px; opacity: .85; margin: 0; }
.brand-ai { font-size: 11px; padding: 2px 8px; border-radius: 99px; border: 1px solid currentColor; opacity: .9; }
.demo-note { font-size: 12px; opacity: .8; margin: 6px 0 0; }

.tabs { display: flex; gap: 4px; margin-top: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; border: 0; background: transparent; padding: 10px 14px; cursor: pointer;
  font-size: 14px; border-bottom: 2px solid transparent; opacity: .75; white-space: nowrap;
}
.tab[aria-selected="true"] { opacity: 1; border-bottom-color: currentColor; font-weight: 700; }

/* ── 本文 ── */
main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 64px; }
[data-panel][hidden] { display: none !important; }
h2.sec { font-family: var(--font-head); font-weight: 600; font-size: 19px; margin: 8px 0 14px; letter-spacing: .04em; }
h3 { font-family: var(--font-head); font-weight: 600; font-size: 16px; margin: 0 0 10px; }
.lead { color: var(--muted); font-size: 13px; margin: -8px 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: 1fr; }
.grid.kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) {
  .grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .grid.side { grid-template-columns: 300px minmax(0, 1fr); }
  .grid.kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.kpi-tile { padding: 14px 16px; }
.kpi-tile .label { font-size: 12px; color: var(--muted); }
.kpi-tile .value { font-family: var(--font-latin); font-size: 28px; line-height: 1.2; margin-top: 4px; }
.kpi-tile .value small { font-size: 13px; margin-left: 2px; font-family: var(--font-body); }
.kpi-tile.alert .value { color: var(--warn); }

/* ── ボタン・入力 ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); padding: 9px 16px;
  border-radius: var(--radius); cursor: pointer; font-size: 14px; line-height: 1.3; text-decoration: none;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { opacity: .9; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn.block { width: 100%; }
.btn.ai::before { content: "✦"; font-size: 12px; }

.field { display: block; }
.field > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius);
  padding: 9px 11px; font-size: 15px; outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.7; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 5px 12px;
  font-size: 13px; cursor: pointer; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip .n { margin-left: 4px; opacity: .75; }

.badge { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.badge.ok { background: #e6efe4; color: var(--ok); }
.badge.warn { background: #f6ecdc; color: var(--warn); }
.badge.danger { background: #f5e3df; color: var(--danger); }
.badge.plain { background: var(--surface-2); color: var(--muted); }

/* ── 一覧 ── */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.list-btn { width: 100%; text-align: left; background: transparent; border: 0; padding: 10px 12px; border-radius: var(--radius); cursor: pointer; }
.list-btn:hover { background: var(--surface-2); }
.list-btn[aria-current="true"] { background: var(--accent-soft); }

.bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tbl th { font-size: 12px; color: var(--muted); font-weight: 500; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tfoot td { font-weight: 700; border-bottom: 0; }

/* ── AI ── */
.ai-box { border: 1px dashed var(--accent); background: var(--accent-soft); border-radius: var(--radius); padding: 12px 14px; }
.ai-box .label { font-size: 12px; color: var(--accent); font-weight: 700; margin-bottom: 6px; }
.callout { border-left: 3px solid var(--warn); background: #fbf4e8; padding: 10px 12px; border-radius: 0 var(--radius) var(--radius) 0; font-size: 13.5px; }
.callout.info { border-left-color: var(--accent); background: var(--accent-soft); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── モーダル・トースト ── */
dialog.modal { border: 0; border-radius: calc(var(--radius) + 4px); padding: 0; width: min(560px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog.modal::backdrop { background: rgba(30, 24, 18, .45); }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  background: var(--text); color: var(--surface); padding: 10px 18px; border-radius: 99px; font-size: 14px;
  transition: opacity .2s, transform .2s; pointer-events: none; z-index: 50; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.app-foot { max-width: 1100px; margin: 0 auto; padding: 0 16px 40px; font-size: 12px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
.app-foot button { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; padding: 0; font-size: 12px; }

.empty { text-align: center; color: var(--muted); padding: 28px 0; font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
