/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f8f9fa;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-sub: #6b7280;
  --text-muted: #9ca3af;
  --accent: #333333;
  --border: #e5e7eb;
  --border-light: #f0f0f0;
  --green: #22c55e;
  --red: #dc2626;
  --blue: #3b82f6;
  --shadow: 0 1px 3px rgba(0,0,0,0.04);
  --radius: 12px;
  --radius-sm: 8px;
  --nav-h: 56px;
  --bottom-h: 0px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* === Login === */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  background: var(--bg);
  padding: 20px;
}
.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 760px;
  text-align: center;
}
.portal-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; text-align: left; }
.portal-col h3 { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; color: var(--text-sub); margin: 0 0 10px; text-transform: uppercase; text-align: center; }
@media (max-width: 640px) {
  .portal-cols { grid-template-columns: 1fr; gap: 16px; }
}
.login-logo { margin-bottom: 32px; }
.login-logo h1 { font-size: 22px; font-weight: 700; letter-spacing: 3px; }
.login-logo p { color: var(--text-sub); font-size: 13px; margin-top: 6px; letter-spacing: 2px; }
/* Aladdin ブランド: 筆記体 (Great Vibes) */
.brand-script {
  font-family: 'Great Vibes', cursive !important;
  font-weight: 400 !important;
  font-size: 76px !important;
  letter-spacing: 1px !important;
  line-height: 1 !important;
  background: linear-gradient(135deg, #1a1a1a 0%, #555 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}
.brand-script-sm {
  font-family: 'Great Vibes', cursive !important;
  font-weight: 400 !important;
  font-size: 26px !important;
  letter-spacing: 0.5px !important;
  line-height: 1 !important;
  text-transform: none !important;
}
.input-group { text-align: left; margin-bottom: 20px; }
.input-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-sub); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.input-group input, .form-input {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  background: var(--bg);
}
.input-group input:focus, .form-input:focus { border-color: var(--accent); }
.btn-primary {
  width: 100%; padding: 13px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  transition: opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary:active { transform: scale(0.98); }
.error-msg { color: var(--red); font-size: 13px; margin-top: 12px; }

/* === Header === */
.header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 6px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header.role-promo { background: #f0fdf4; border-bottom-color: #bbf7d0; }
.header.role-promo .logo-text { color: #15803d; }
.header.role-custom { background: #eff6ff; border-bottom-color: #bfdbfe; }
.header.role-custom .logo-text { color: #1d4ed8; }
.header-user { font-size: 11px; color: var(--text-sub); background: var(--bg); padding: 4px 10px; border-radius: 12px; white-space: nowrap; }

/* Funnel */
.funnel { display: flex; align-items: center; gap: 0; padding: 20px 0; }
.funnel-step { flex: 1; text-align: center; position: relative; }
.funnel-bar { height: 60px; margin: 0 auto; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-direction: column; color: white; font-weight: 700; transition: width 0.3s; }
.funnel-label { font-size: 11px; color: var(--text-sub); margin-top: 8px; }
.funnel-rate { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.funnel-arrow { font-size: 20px; color: var(--border); flex-shrink: 0; margin: 0 -4px; }

/* Toast notification */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: white; padding: 10px 24px;
  border-radius: 8px; font-size: 13px; font-weight: 500;
  z-index: 9999; opacity: 0; transition: opacity 0.3s;
  pointer-events: none; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.toast.show { opacity: 1; }
.toast.error { background: var(--red); }

/* Copy button */
.copy-btn {
  font-size: 10px; padding: 2px 8px; border: 1px solid var(--border);
  background: var(--bg); border-radius: 4px; cursor: pointer;
  color: var(--text-sub); margin-left: 6px;
}
.copy-btn:hover { border-color: var(--accent); color: var(--text); }
.header-left { display: flex; align-items: center; gap: 10px; margin-right: 24px; }
.logo-text {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text);
}

/* Desktop Nav */
.desktop-nav { display: flex; gap: 2px; margin-left: 0; flex-wrap: nowrap; overflow-x: auto; min-width: 0; scrollbar-width: thin; }
.desktop-nav::-webkit-scrollbar { height: 4px; }
.desktop-nav::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }
.nav-btn {
  padding: 8px 14px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.15s;
  min-height: 36px;
  white-space: nowrap;
  flex: 0 0 auto;
  -webkit-tap-highlight-color: transparent;
}
.nav-btn:hover { background: var(--bg); color: var(--text); }
.nav-btn.active { background: var(--accent); color: white; }
.nav-spacer { flex: 1; }
.btn-logout {
  padding: 7px 14px;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-sub);
  cursor: pointer;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

/* Sub Nav */
.sub-nav {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
  display: flex;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex-wrap: nowrap;
  scrollbar-width: none;
}
.sub-nav::-webkit-scrollbar { display: none; }
.sub-nav-btn {
  padding: 8px 10px;
  border: none;
  background: transparent;
  font-size: 12px;
  color: var(--text-sub);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.sub-nav-btn:hover { color: var(--text); }
.sub-nav-btn.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.sub-nav .sub-divider { width: 1px; background: var(--border); margin: 6px 4px; flex-shrink: 0; }

/* === v369: グローバルヘッダー圧縮 (Aladdin ロゴクリックでトグル) === */
body.header-collapsed .header { display: none !important; }
body.header-collapsed .sub-nav,
body.header-collapsed #kaiin-sub-nav { display: none !important; }
#header-restore-btn {
  position: fixed;
  top: 6px; left: 8px;
  z-index: 9999;
  display: none;
  padding: 4px 10px;
  font-family: 'Great Vibes', cursive;
  font-size: 18px;
  letter-spacing: 1px;
  color: var(--text);
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  transition: background .15s, transform .15s;
}
#header-restore-btn:hover { background: #fff; transform: scale(1.03); }
body.header-collapsed #header-restore-btn { display: inline-block; }
#header-logo-toggle:hover { opacity: 0.7; }

/* Bottom Nav */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(60px + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--card);
  border-top: 1px solid var(--border);
  z-index: 100;
}
.bottom-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-btn svg { width: 20px; height: 20px; }
.bottom-nav-btn.active { color: var(--accent); }

/* === Content === */
.view { padding: 24px; padding-bottom: calc(24px + var(--bottom-h)); max-width: 1200px; margin: 0 auto; }
.view.view-wide { max-width: 100%; padding: 8px; }
.data-table.compact td, .data-table.compact th { padding: 4px 5px; vertical-align: middle; }
.data-table.compact { table-layout: fixed; width: 100%; }
.data-table.compact th { text-align: center; position: sticky; top: 0; background: var(--card); z-index: 10; border-bottom: 2px solid var(--border); }
.data-table.compact td { text-align: center; }
.view[hidden] { display: none !important; }
.page-header { margin-bottom: 20px; }
.page-header h2 { font-size: 18px; font-weight: 700; }
.page-desc { color: var(--text-sub); font-size: 13px; margin-top: 4px; }

/* === Cards === */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

/* === Stats === */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
}
.stat-num { font-size: 22px; font-weight: 700; color: var(--text); display: block; line-height: 1.2; }
.stat-yoy { font-size: 11px; font-weight: 600; margin-top: 1px; display: block; }
.stat-label { font-size: 10px; color: var(--text-sub); margin-top: 2px; display: block; text-transform: uppercase; letter-spacing: 0.3px; }

/* === Stats Row 統一 (来院/予約等の compact 行) === */
.stats-row-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
/* warning/danger/success モディファイア: 全タブ共通の 要対応・キャンセル・成約 表現 */
.stat-card.is-warning {
  border-color: #f97316;
  background: #fff7ed;
}
.stat-card.is-warning .stat-label { color: #c2410c; font-weight: 700; }
.stat-card.is-warning .stat-num   { color: #c2410c; }
.stat-card.is-danger {
  border-color: #ef4444;
  background: #fef2f2;
}
.stat-card.is-danger .stat-label { color: #b91c1c; font-weight: 700; }
.stat-card.is-danger .stat-num   { color: #b91c1c; }
.stat-card.is-success {
  border-color: #22c55e;
  background: #f0fdf4;
}
.stat-card.is-success .stat-label { color: #15803d; font-weight: 700; }
.stat-card.is-success .stat-num   { color: #059669; }
.stat-card.is-info {
  border-color: #3b82f6;
  background: #eff6ff;
}
.stat-card.is-info .stat-label { color: #1d4ed8; font-weight: 700; }
.stat-card.is-info .stat-num   { color: #1d4ed8; }

/* === Clinic Grid === */
.clinic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.clinic-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.clinic-card:hover { border-color: var(--accent); }
.clinic-card:active { transform: scale(0.99); }
.clinic-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.clinic-card-header h3 { font-size: 14px; font-weight: 600; line-height: 1.4; }
.overall-score {
  min-width: 40px; height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.score-high { background: linear-gradient(135deg, #1a1a1a, #444); }
.score-mid { background: linear-gradient(135deg, #9ca3af, #6b7280); }
.score-low { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.clinic-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; }
.score-bars { display: flex; flex-direction: column; gap: 6px; }
.score-row { display: flex; align-items: center; gap: 8px; }
.score-row .label { font-size: 11px; color: var(--text-sub); width: 70px; }
.score-bar { flex: 1; height: 4px; background: var(--border-light); border-radius: 2px; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 2px; }
.score-bar-fill.bar-reception { background: #6366f1; }
.score-bar-fill.bar-counseling { background: #0ea5e9; }
.score-bar-fill.bar-hospitality { background: #a855f7; }
.score-bar-fill.bar-environment { background: #f59e0b; }
.score-row .value { font-size: 11px; font-weight: 600; width: 16px; text-align: right; }
.clinic-card-footer {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-light);
  font-size: 12px; color: var(--text-sub); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* === Tables === */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; padding: 6px 8px;
  font-size: 10px; font-weight: 700; color: var(--text-sub);
  text-transform: uppercase; letter-spacing: 0.3px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  background: #fafafa;
}
.data-table td { padding: 6px 8px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.data-table tbody tr:nth-child(even) td { background: #fcfcfd; }
.data-table tbody tr:hover td { background: #f1f5f9; }
.data-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-sm); }

/* === Forms === */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-label { font-size: 11px; font-weight: 600; color: var(--text-sub); text-transform: uppercase; letter-spacing: 0.3px; }
.form-input { font-size: 14px; padding: 10px 12px; }
.form-select {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--bg);
  outline: none;
  -webkit-appearance: none;
}
.form-actions { display: flex; gap: 10px; margin-top: 16px; }
.btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  min-height: 44px;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s, transform 0.1s, border-color 0.15s, color 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-dark { background: var(--accent); color: white; border-color: var(--accent); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-sub); }
.btn-outline:hover { border-color: var(--accent); color: var(--text); opacity: 1; }
.btn-success { background: #059669; color: #fff; border-color: #059669; }
.btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-warning { background: #f97316; color: #fff; border-color: #f97316; }
/* サイズモディファイア */
.btn.btn-sm {
  padding: 5px 12px;
  font-size: 11px;
  min-height: 28px;
  border-radius: 14px;
}
.btn.btn-md {
  padding: 7px 16px;
  font-size: 12px;
  min-height: 34px;
  border-radius: 16px;
}

/* === Status Badge === */
.badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 20px; font-size: 11px; font-weight: 600;
}
.badge-default { background: var(--bg); color: var(--text-sub); border: 1px solid var(--border); }
.badge-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.badge-warning { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.badge-danger { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

/* === 状態バッジ統一クラス (全タブで同じ見た目) === */
.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.4;
  border: 1.5px solid;
  cursor: default;
}
.status-pill-mut    { color: #6b7280; background: #f3f4f6; border-color: #d1d5db; }
.status-pill-orange { color: #c2410c; background: #fff7ed; border-color: #fdba74; }
.status-pill-purple { color: #9333ea; background: #faf5ff; border-color: #d8b4fe; }
.status-pill-cyan   { color: #0e7490; background: #ecfeff; border-color: #67e8f9; }
.status-pill-blued  { color: #0369a1; background: #f0f9ff; border-color: #7dd3fc; }
.status-pill-blue   { color: #1d4ed8; background: #eff6ff; border-color: #93c5fd; }
.status-pill-violet { color: #7c3aed; background: #f5f3ff; border-color: #c4b5fd; }
.status-pill-teal   { color: #0891b2; background: #ecfeff; border-color: #67e8f9; }
.status-pill-green  { color: #059669; background: #ecfdf5; border-color: #86efac; }
.status-pill-red    { color: #dc2626; background: #fef2f2; border-color: #fca5a5; }
/* select として使う場合のリセット (背景画像の矢印は個別 inline style に任せる) */
select.status-pill {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  padding-right: 24px;
}

/* === フィルタバー統一クラス (予約一覧をベースに全タブで共通化) === */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.filter-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-label {
  font-size: 10px;
  font-weight: 700;
  color: #666;
  letter-spacing: 1px;
  width: 50px;
  flex: 0 0 auto;
}
.filter-input {
  padding: 6px 10px;
  font-size: 11px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  outline: none;
  min-height: 28px;
  box-sizing: border-box;
}
.filter-input:focus { border-color: var(--accent); }
.filter-select {
  padding: 6px 8px;
  font-size: 11px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  outline: none;
  width: auto;
  min-height: 28px;
  cursor: pointer;
  box-sizing: border-box;
}
.filter-btn {
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid #d4d4d8;
  border-radius: 14px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  min-height: 28px;
  white-space: nowrap;
}
.filter-btn:hover { border-color: #1d4ed8; color: #1d4ed8; }
.filter-btn.is-active {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
  font-weight: 700;
}
.filter-btn-dark.is-active {
  background: #1a1a1a;
  border-color: #1a1a1a;
}

/* === Facility Tabs === */
.facility-tabs {
  display: flex; gap: 0; overflow-x: auto;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  -webkit-overflow-scrolling: touch;
}
.facility-tab {
  padding: 10px 16px;
  border: none; background: transparent;
  font-size: 13px; color: var(--text-sub);
  cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent;
  -webkit-tap-highlight-color: transparent;
}
.facility-tab:hover { color: var(--text); }
.facility-tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

/* === Bar Chart === */
.bar-chart { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: flex; align-items: center; gap: 12px; }
.bar-label { font-size: 12px; width: 180px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; }
.bar-track { flex: 1; max-width: 300px; height: 24px; background: var(--bg); border-radius: 4px; overflow: hidden; position: relative; }
.bar-fill { height: 100%; background: linear-gradient(90deg, #6366f1, #8b5cf6); border-radius: 4px; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; min-width: 30px; }
.bar-fill span { font-size: 11px; font-weight: 600; color: white; }
.bar-value { font-size: 13px; font-weight: 600; width: 50px; text-align: right; }

/* === Strategy === */
.strategy-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.strategy-section { grid-column: 1 / -1; }
.strategy-section .card-header { margin-bottom: 12px; }
.kpi-box { display: flex; gap: 16px; }
.kpi { flex: 1; text-align: center; padding: 16px; background: var(--bg); border-radius: var(--radius-sm); }
.kpi-label { display: block; font-size: 11px; color: var(--text-sub); }
.kpi-value { font-size: 28px; font-weight: 700; }
.kpi-value.red { color: var(--red); }
.kpi-value.green { color: var(--green); }
.tag { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; color: white; }
.tag-red { background: var(--red); }
.tag-orange { background: #f59e0b; }
.tag-blue { background: var(--blue); }
.issue-list { list-style: none; }
.issue-list li { padding: 10px 0; border-bottom: 1px solid var(--border-light); display: flex; align-items: center; gap: 10px; font-size: 14px; }
.issue-list li:last-child { border-bottom: none; }
.action-columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.action-col h4 { font-size: 13px; padding-bottom: 8px; border-bottom: 2px solid var(--accent); margin-bottom: 10px; }
.action-list { list-style: none; }
.action-list li { padding: 8px 12px; margin-bottom: 4px; background: var(--bg); border-radius: var(--radius-sm); font-size: 13px; border-left: 3px solid var(--accent); }
.suggestion-by-clinic { margin-bottom: 16px; }
.suggestion-by-clinic h4 { font-size: 14px; margin-bottom: 8px; }
.suggestion-by-clinic ul { list-style: none; }
.suggestion-by-clinic li { padding: 6px 12px; margin-bottom: 4px; background: var(--bg); border-radius: var(--radius-sm); font-size: 13px; border-left: 3px solid var(--green); }
.notes-area {
  width: 100%; min-height: 120px; padding: 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 16px; font-family: inherit; line-height: 1.6;
  resize: vertical; outline: none; background: var(--bg);
}
.notes-area:focus { border-color: var(--accent); }
.btn-save { margin-top: 12px; }
.save-status { margin-left: 12px; font-size: 13px; color: var(--green); }

/* === Modal === */
.modal[hidden] { display: none !important; }
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.modal-content {
  position: relative; background: var(--card);
  border-radius: var(--radius); width: 90%; max-width: 800px;
  max-height: 85vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 28px; border: 1px solid var(--border);
}
.modal-close {
  position: sticky; top: 0; float: right;
  width: 40px; height: 40px; border: 1px solid var(--border);
  background: var(--card); border-radius: 50%;
  font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; z-index: 1;
}
.modal-close:hover { background: var(--red); color: white; border-color: var(--red); }
.detail-header { margin-bottom: 20px; }
.detail-header h2 { font-size: 18px; font-weight: 700; }
.detail-meta { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.detail-scores { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px; }
.detail-score-card { text-align: center; padding: 14px 8px; background: var(--bg); border-radius: var(--radius-sm); }
.detail-score-card .score-val { font-size: 24px; font-weight: 700; }
.detail-score-card .score-name { font-size: 10px; color: var(--text-sub); }
.detail-section { margin-bottom: 18px; }
.detail-section h3 { font-size: 13px; font-weight: 600; color: var(--text-sub); text-transform: uppercase; letter-spacing: 0.5px; padding-bottom: 8px; border-bottom: 1px solid var(--border-light); margin-bottom: 10px; }
.detail-grid { display: grid; grid-template-columns: 90px 1fr; gap: 4px 12px; font-size: 13px; }
.detail-grid dt { font-weight: 600; color: var(--text-sub); font-size: 12px; }
.detail-grid dd { color: var(--text); }
.detail-list { list-style: none; }
.detail-list li { padding: 6px 0; border-bottom: 1px solid var(--border-light); font-size: 13px; }
.detail-list li:last-child { border-bottom: none; }
.detail-flow { list-style: none; counter-reset: flow; }
.detail-flow li {
  counter-increment: flow; padding: 6px 12px 6px 32px;
  position: relative; font-size: 13px;
  border-left: 1px solid var(--border); margin-left: 10px;
}
.detail-flow li::before {
  content: counter(flow); position: absolute; left: -10px;
  width: 20px; height: 20px; background: var(--accent);
  color: white; border-radius: 50%; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.strength-item, .improve-item { padding: 8px 12px; margin-bottom: 4px; border-radius: var(--radius-sm); font-size: 13px; }
.strength-item { background: #f0fdf4; border-left: 3px solid var(--green); }
.improve-item { background: #fffbeb; border-left: 3px solid #f59e0b; }

/* === Resource Links === */
.resource-list { list-style: none; }
.resource-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 8px; background: var(--bg); border-radius: var(--radius-sm); font-size: 13px; cursor: pointer; border: 1px solid var(--border-light); transition: border-color 0.15s; text-decoration: none; color: var(--text); }
.resource-item:hover { border-color: var(--accent); }
.resource-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; color: white; }
.resource-icon.doc-pdf { background: #dc2626; }
.resource-icon.doc-audio { background: #6366f1; }
.resource-icon.doc-photo { background: #0ea5e9; }
.resource-icon.doc-data { background: #22c55e; }
.resource-icon.doc-other { background: var(--accent); }
.resource-meta { flex: 1; }
.resource-meta .doc-title { font-weight: 600; font-size: 14px; }
.resource-meta .doc-sub { font-size: 11px; color: var(--text-sub); margin-top: 2px; }
.resource-delete { width: 32px; height: 32px; border: 1px solid var(--border); background: transparent; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 14px; color: var(--text-muted); flex-shrink: 0; }
.resource-delete:hover { border-color: var(--red); color: var(--red); }

/* === Settings === */
.settings-list { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.settings-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 16px 20px;
  border: none; background: transparent; font-size: 14px; color: var(--red);
  cursor: pointer; text-align: left; border-bottom: 1px solid var(--border-light); min-height: 52px;
}
.settings-item:last-child { border-bottom: none; }
.settings-item svg { width: 20px; height: 20px; }

/* === Responsive: Tablet === */
@media (max-width: 768px) {
  .strategy-grid { grid-template-columns: 1fr; }
  .action-columns { grid-template-columns: 1fr; }
  .detail-scores { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr 1fr; }
}

/* === Responsive: Mobile === */
@media (max-width: 640px) {
  :root { --bottom-h: calc(60px + env(safe-area-inset-bottom, 0px)); }
  .desktop-nav, .btn-logout { display: none; }
  .bottom-nav { display: flex; }
  .header { padding: 0 12px; height: 52px; position: sticky; top: 0; z-index: 100; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
  .header h1 { font-size: 15px; letter-spacing: 1px; }
  .sub-nav { padding: 0 12px; position: sticky; top: 52px; z-index: 90; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.04); -webkit-overflow-scrolling: touch; overflow-x: auto; scrollbar-width: none; }
  .sub-nav::-webkit-scrollbar { display: none; }
  .view { padding: 12px; padding-bottom: calc(12px + var(--bottom-h)); }
  .page-header h2 { font-size: 17px; margin: 8px 0 12px; }
  .clinic-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
  .stat-num { font-size: 24px !important; font-weight: 700; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-content { width: 100%; max-width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; padding: 16px; position: fixed; bottom: 0; left: 0; right: 0; top: auto; animation: slideUpMobile 0.22s ease-out; }
  .view-wide { padding: 4px; }
  .view-wide .data-table-wrap { -webkit-overflow-scrolling: touch; overflow-x: auto; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.04); }
  .view-wide .data-table.compact { font-size: 11px; table-layout: auto; min-width: 800px; }
  .view-wide .data-table.compact td, .view-wide .data-table.compact th { padding: 8px 6px; white-space: nowrap; }
  .view-wide .data-table.compact th { font-size: 10px; background: #fafafa; position: sticky; top: 0; z-index: 10; }
  .stat-card { padding: 10px 12px !important; border-radius: 12px !important; }
  .stat-label { font-size: 10px !important; color: var(--text-sub); }
  /* ボトムナビ: タップしやすくする + 見やすく (6項目対応) */
  .bottom-nav { height: calc(62px + var(--safe-b)) !important; background: #fff; box-shadow: 0 -2px 8px rgba(0,0,0,0.06); z-index: 150; }
  .bottom-nav-btn { font-size: 10px !important; padding: 6px 2px !important; gap: 2px; flex: 1; min-width: 0; }
  .bottom-nav-btn svg { width: 20px !important; height: 20px !important; }
  .bottom-nav-btn span { white-space: nowrap; font-size: 9.5px !important; }
  .bottom-nav-btn.active { color: #1d4ed8; font-weight: 600; }
  .bottom-nav-btn.active svg { stroke: #1d4ed8; }
  /* サブナビのタブを指で押しやすく */
  .sub-nav-btn { font-size: 13px !important; padding: 10px 14px !important; min-height: 40px; }
  .sub-nav-btn.active { font-weight: 700; }
  /* フォーム入力: タップ領域を大きく */
  .form-input, .form-select { font-size: 16px !important; min-height: 44px !important; padding: 10px 12px !important; border-radius: 10px !important; }
  .form-label { font-size: 11px !important; font-weight: 600; margin-bottom: 4px; }
  /* ボタン: 押しやすい最小サイズ */
  .btn, button.btn-primary, button.btn-outline, button.btn-dark { min-height: 44px !important; font-size: 14px !important; border-radius: 10px !important; }
  /* フィルタ行: 横スクロール */
  .filter-row, .bk-filters, .kaiin-filter-top { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; flex-wrap: nowrap !important; }
  .filter-row::-webkit-scrollbar, .bk-filters::-webkit-scrollbar { display: none; }
  .form-grid { grid-template-columns: 1fr !important; gap: 10px !important; }
  .bar-label { width: 100px !important; font-size: 11px !important; }
  .bar-track { max-width: 150px !important; }
  .bar-value { font-size: 10px !important; min-width: 60px !important; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-grid dt { margin-top: 8px; font-size: 10px; }
  .detail-grid dd { padding: 6px 10px; background: var(--bg); border-radius: 6px; }
  .login-card { padding: 32px 20px; border-radius: 16px; }
  /* マルチセレクトのドロップダウンを大きく */
  .multi-select-dropdown { width: calc(100vw - 24px) !important; max-width: none !important; }
  /* Sticky name column for 予約タブ (name は 3番目) */
  .view-wide .data-table.compact td:nth-child(3), .view-wide .data-table.compact th:nth-child(3) { position: sticky; left: 0; background: #fff; z-index: 5; box-shadow: 2px 0 4px rgba(0,0,0,0.04); }
  /* 来院タブのテーブル: 1列目(来院日) + 2列目(名前) を両方 sticky に */
  .kaiin-table-wrap .data-table.compact td:nth-child(3),
  .kaiin-table-wrap .data-table.compact th:nth-child(3) {
    position: static !important;
    box-shadow: none !important;
  }
  .kaiin-table-wrap .data-table.compact td:nth-child(1),
  .kaiin-table-wrap .data-table.compact th:nth-child(1) {
    position: sticky !important;
    left: 0 !important;
    background: #fff !important;
    z-index: 6 !important;
    min-width: 55px;
  }
  .kaiin-table-wrap .data-table.compact td:nth-child(2),
  .kaiin-table-wrap .data-table.compact th:nth-child(2) {
    position: sticky !important;
    left: 55px !important;
    background: #fff !important;
    z-index: 5 !important;
    box-shadow: 2px 0 6px rgba(0,0,0,0.08) !important;
    max-width: 100px;
  }
  /* 偶数行の背景色も引き継ぎ */
  .kaiin-table-wrap .data-table.compact tbody tr:nth-child(even) td:nth-child(1),
  .kaiin-table-wrap .data-table.compact tbody tr:nth-child(even) td:nth-child(2) {
    background: #fafafa !important;
  }
  /* トースト: 上に表示（大きくて見やすく） */
  .toast { bottom: calc(80px + var(--safe-b)) !important; max-width: 85vw; font-size: 14px !important; padding: 12px 16px !important; border-radius: 12px !important; }
  /* 入力欄フォーカス時ズーム防止 (iOS) */
  input, select, textarea { font-size: 16px !important; }
}
@media (max-width: 380px) {
  .stat-num { font-size: 20px !important; }
  .stats-row { grid-template-columns: 1fr 1fr !important; gap: 6px !important; }
  .sub-nav-btn { padding: 10px 10px !important; font-size: 12px !important; }
  .header h1 { font-size: 13px; }
  .modal-content { padding: 12px !important; padding-top: 56px !important; }
  .data-table th, .data-table td { font-size: 10px !important; padding: 6px 4px !important; }
}

/* ================================================== */
/*  📱 モバイル UI 改善パック (v258) */
/*  タップ可能領域を 44x44px 基準に統一、操作性向上   */
/* ================================================== */
@media (max-width: 768px) {
  /* すべてのタップ可能要素に最小 44px を保証 (iOS/Material 推奨) */
  .btn, .btn-primary, .btn-dark, .btn-outline,
  .sub-nav-btn, .nav-btn {
    min-height: 44px !important;
  }
  /* iOS入力ズーム防止をタブレット域にも拡張 */
  input, select, textarea,
  .form-input, .form-select {
    font-size: 16px !important;
  }
  /* ヘッダー内アクションボタン */
  .header .btn, .header button {
    min-height: 40px !important;
    padding: 8px 12px !important;
  }
}

@media (max-width: 640px) {
  /* モーダル閉じるボタン: 絶対配置で 44x44、コンテンツ上部に余裕 */
  .modal-close {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    width: 44px !important;
    height: 44px !important;
    float: none !important;
    z-index: 10 !important;
    font-size: 22px !important;
    border-radius: 50% !important;
  }
  .modal-content {
    padding-top: 60px !important;
    position: relative !important;
  }
  /* コピー等の小ボタン: モバイルではタップしやすく */
  .copy-btn {
    min-height: 36px !important;
    padding: 8px 12px !important;
    font-size: 11px !important;
  }
  /* 削除ボタン */
  .resource-delete {
    width: 44px !important;
    height: 44px !important;
    font-size: 18px !important;
  }
  /* ボトムナビの各ボタン: タップ幅保証 */
  .bottom-nav-btn {
    min-width: 44px !important;
    min-height: 56px !important;
  }
  /* 横スクロール行: 右端にフェードで「まだスクロールできる」ヒント */
  .bk-filters::after, .filter-row::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 24px;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.9));
    pointer-events: none;
    z-index: 2;
  }
  .bk-filters, .filter-row {
    position: relative !important;
  }
  /* テーブル: フォントは読みやすく、カラム間の余白を詰める */
  .data-table-wrap {
    position: relative;
  }
  /* ヘッダータップ対象を明確に */
  .header .btn-logout, .header #refresh-btn {
    min-height: 40px !important;
    min-width: 44px !important;
  }
  /* 詳細グリッド: dt/dd を横並びに戻す (情報密度UP) */
  .detail-grid {
    grid-template-columns: 90px 1fr !important;
    gap: 6px 10px !important;
  }
  .detail-grid dt {
    font-size: 11px !important;
    color: var(--text-sub) !important;
    align-self: center !important;
  }
  .detail-grid dd {
    font-size: 13px !important;
    align-self: center !important;
  }
  /* テーブル内のselect/input: タップで反応することを優先 */
  .data-table select, .data-table input[type="text"],
  .data-table input[type="date"], .data-table input[type="number"] {
    min-height: 36px !important;
    padding: 4px 6px !important;
  }
  /* プルリフレッシュヒント (後続で JS と連動) */
  .pull-refresh-hint {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translate(-50%, -100%);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 8px 18px;
    border-radius: 0 0 16px 16px;
    font-size: 12px;
    z-index: 9999;
    transition: transform 0.2s ease;
    pointer-events: none;
  }
  .pull-refresh-hint.show {
    transform: translate(-50%, 0);
  }

  /* ================ v259 追加モバイル改善 ================ */
  /* テーブルセル内のインライン font-size (10/11px 指定) を上書き */
  .view-wide .data-table td, .view-wide .data-table th {
    font-size: 12px !important;
  }
  .view-wide .data-table td *, .view-wide .data-table th * {
    font-size: inherit !important;
  }
  /* テーブル内ボタン/select/input のタップ領域とフォント */
  .view-wide .data-table td select,
  .view-wide .data-table td button,
  .view-wide .data-table td input:not([type="checkbox"]):not([type="radio"]) {
    font-size: 13px !important;
    min-height: 36px !important;
    padding: 6px 8px !important;
  }
  /* 金額カラムの input だけは右揃えを維持 */
  .view-wide .data-table td input[type="number"],
  .view-wide .data-table td .kaiin-money,
  .view-wide .data-table td .bk-edit-amount {
    text-align: right !important;
  }
  /* テーブル横スクロール時の視認性UP */
  .view-wide .data-table-wrap {
    box-shadow: inset -12px 0 12px -12px rgba(0,0,0,0.12);
  }
  /* ヘッダー内のログアウト/更新ボタン */
  .header .btn-logout, #refresh-btn, .btn-refresh {
    font-size: 12px !important;
  }
}

/* === v261 ヘッダー通知バッジ === */
.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #f59e0b;
  transition: transform 0.15s, box-shadow 0.15s;
  user-select: none;
  white-space: nowrap;
}
.header-badge:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25); }
.header-badge:active { transform: translateY(0); }
.header-badge.urgent {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  color: #b91c1c;
  border-color: #dc2626;
  animation: badgePulse 2s infinite;
}
@keyframes badgePulse { 0%,100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); } 50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); } }
@media (max-width: 640px) {
  .header-badge { font-size: 11px; padding: 4px 8px; }
}

/* === v261 スケルトンローダー === */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #f8f8f8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeletonPulse 1.5s ease-in-out infinite;
  border-radius: 6px;
  color: transparent !important;
  pointer-events: none;
}
@keyframes skeletonPulse { 0% { background-position: 200% 0 } 100% { background-position: -200% 0 } }
.skeleton-row { height: 36px; margin-bottom: 6px; }
.skeleton-card { height: 64px; margin-bottom: 8px; border-radius: 10px; }

/* === v261 プルリフレッシュ (v266 機能削除 — 「じゃま」で全環境で非表示) === */
.pull-refresh-indicator { display: none !important; }
.pull-refresh-indicator.loading svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 380px 以下 (小型スマホ) 追加調整 */
@media (max-width: 380px) {
  .view-wide .data-table td, .view-wide .data-table th {
    font-size: 11px !important;
    padding: 6px 4px !important;
  }
  .view-wide .data-table td select,
  .view-wide .data-table td input:not([type="checkbox"]) {
    font-size: 12px !important;
    min-height: 34px !important;
  }
  .header h1 { font-size: 13px !important; letter-spacing: 0.5px !important; }
  /* ボタン類もタップしやすく */
  .btn, .btn-primary, .btn-outline { font-size: 13px !important; }
}

/* ================================================== */
/*  📱 v260 モバイル総点検: 見やすさ/使いやすさ/スピード */
/* ================================================== */
@media (max-width: 768px) {
  /* フィルター行を画面上部に sticky 化 (表と同時スクロール衝突の解消) */
  .bk-filters, .kaiin-filter-top, .filter-row {
    position: sticky !important;
    top: 52px !important;  /* ヘッダーの下 */
    z-index: 40 !important;
    background: #fff !important;
    padding: 8px 10px !important;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }
  /* サブナビも sticky (タブと filter 両方見える) */
  .sub-nav {
    position: sticky !important;
    top: 0 !important;
    z-index: 45 !important;
    background: #fff !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    padding: 4px 8px !important;
  }
  /* 数値カード (stat-card) の並びを 3列 → 2列 に縮小 */
  .stats-row { grid-template-columns: repeat(2, 1fr) !important; gap: 6px !important; }
  .stat-card { padding: 8px 10px !important; border-radius: 10px !important; }
  .stat-num { font-size: 18px !important; }
  .stat-label { font-size: 10px !important; }
  /* セレクト/ドロップダウンのラベル見やすく */
  .multi-select-trigger { min-height: 38px !important; font-size: 13px !important; padding: 6px 10px !important; }
  /* アクションボタン群のギャップ */
  .action-btns, .header-actions { gap: 6px !important; }
  /* モーダルの閉じボタンをさらに大きく */
  .modal-close {
    width: 48px !important;
    height: 48px !important;
    font-size: 24px !important;
    background: rgba(0,0,0,0.05) !important;
  }
  /* カード/セクションの角丸を柔らかく */
  .card, .kaiin-all-card, .reward-card { border-radius: 14px !important; }

  /* タブ切替時のちらつき軽減 (軽量アニメ) */
  .view { animation: fadeIn 0.12s ease-out; }
  @keyframes fadeIn { from { opacity: 0.7 } to { opacity: 1 } }

  /* 長いツールバーを省略表示 (ブロック内で横スクロールさせる) */
  .page-header { padding: 8px 10px !important; min-height: auto !important; flex-wrap: wrap !important; }
  .page-header h2 { font-size: 15px !important; margin: 0 0 4px !important; }
  /* ステータスバッジを小さく、視認性保つ */
  .badge { padding: 3px 8px !important; font-size: 10px !important; font-weight: 600 !important; }

  /* 入力欄の読み込み中のちらつき抑制 */
  .data-table tbody tr { contain: layout style; }

  /* モバイルで非優先な列を縮小 (売上・交通費等は折り畳み風) */
  .kaiin-table-wrap .data-table.compact td:nth-child(n+7),
  .kaiin-table-wrap .data-table.compact th:nth-child(n+7) {
    min-width: auto !important;
  }
}

/* モーダル スライドアップアニメーション (モバイル) */
@keyframes slideUpMobile {
  from { transform: translateY(100%); opacity: 0.8; }
  to { transform: translateY(0); opacity: 1; }
}

/* 成約なのに商材/金額が未入力のアラート */
@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  50%      { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
}

/* 予約タブ内のBFは来院管理へ移管したため非表示 (データは保持) */
#bf-tab-btn,
#sub-bk-bf { display: none !important; }

/* 来院タブ: 四角枠を外した選択UIのホバー表示 */
.kaiin-plain-sel:hover,
.kaiin-csfac-btn:hover {
  background: rgba(0,0,0,0.04) !important;
  border-radius: 4px;
}
.kaiin-plain-sel:focus {
  background: #fff !important;
  outline: 1px solid var(--border);
  border-radius: 4px;
}
/* マルチセレクトフィルターボタン */
.multi-select-btn {
  transition: background 0.15s, border-color 0.15s;
}
.multi-select-btn:hover {
  border-color: #1d4ed8 !important;
}
@media (max-width: 640px) {
  .multi-select-popup { max-width: 90vw !important; }
}

/* ══ 印刷用スタイル (PDF出力) v108 ══ */
body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  html, body {
    background: #fff !important;
    color: #000 !important;
    font-size: 10px !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  /* 不要な UI を非表示 (テーブル内部の input/select/button は残す) */
  .header,
  .sub-nav,
  #kaiin-sub-nav,
  .kaiin-topbar,
  .kaiin-header-toggle,
  .kaiin-header-wrap,
  .bk-toolbar,
  .multi-select-btn,
  .multi-select-popup,
  .toast,
  #bk-quick-promos,
  #bk-csv,
  #bk-pdf,
  #bk-refresh,
  #bk-dup-filter,
  .kaiin-pdf-btn,
  .bk-pdf-btn,
  .bk-del-btn,
  .kaiin-del-btn,
  .page-header > *:not(h2):not(.print-title) {
    display: none !important;
  }
  /* テーブルセル内の編集UIはテキストに見せる (枠/背景/矢印/スピナー を消す) */
  .data-table td input,
  .data-table td select,
  .data-table td button,
  .data-table td textarea {
    display: inline-block !important;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 10px !important;
    color: #000 !important;
    width: auto !important;
    min-width: 0 !important;
    height: auto !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    box-shadow: none !important;
    outline: none !important;
  }
  /* 隠しピッカー用 input は完全非表示 */
  .data-table td .bk-next-date-hidden,
  .data-table td .kaiin-next-date-hidden,
  .data-table td .kaiin-bookdate-hidden,
  .data-table td .bk-month-hidden,
  input[type="date"][style*="opacity:0"],
  input[type="month"][style*="opacity:0"] {
    display: none !important;
  }
  /* select のドロップダウン矢印 (SVG background) を消す */
  .data-table td select {
    background-image: none !important;
    padding-right: 0 !important;
  }
  .page-header {
    display: block !important;
    padding: 0 !important;
    margin: 0 0 6px 0 !important;
    border: none !important;
    background: transparent !important;
  }
  .page-header h2 {
    display: block !important;
    margin: 0 0 4px 0 !important;
    font-size: 14px !important;
    color: #000 !important;
  }
  /* テーブルは全行表示・ページ跨ぎでヘッダー繰り返し */
  .data-table-wrap,
  .kaiin-table-wrap {
    max-height: none !important;
    overflow: visible !important;
    height: auto !important;
  }
  table.data-table,
  .data-table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 10px !important;
    page-break-inside: auto;
  }
  table.data-table thead,
  .data-table thead {
    display: table-header-group !important;
  }
  table.data-table tbody tr,
  .data-table tbody tr {
    page-break-inside: avoid;
  }
  table.data-table th,
  table.data-table td,
  .data-table th,
  .data-table td {
    border: 1px solid #999 !important;
    padding: 2px 4px !important;
    font-size: 10px !important;
    color: #000 !important;
    background-clip: padding-box !important;
  }
  table.data-table th,
  .data-table th {
    background: #eee !important;
    font-weight: 600 !important;
  }
  /* バッジなどインライン要素の背景色を印刷で維持 */
  .badge,
  [style*="background"] {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  /* レイアウト調整 */
  .container, .main, .content, body {
    margin: 0 !important;
    padding: 0 !important;
  }
  .card {
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
  }
  /* 印刷中は「さらに表示」ボタン行などを非表示 */
  tr td[colspan] button { display: none !important; }
}

/* ===== 来院一覧テーブル: 携帯ではカード表示に変身 ===== */
@media (max-width: 768px) {
  .kaiin-all-list-table thead { display: none; }
  .kaiin-all-list-table, .kaiin-all-list-table tbody, .kaiin-all-list-table tr, .kaiin-all-list-table td { display: block; width: 100%; box-sizing: border-box; }
  .kaiin-all-list-table tr {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    padding: 8px 10px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,.03);
  }
  .kaiin-all-list-table td {
    border: none;
    padding: 3px 0;
    text-align: left !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 12px !important;
  }
  .kaiin-all-list-table td::before {
    content: attr(data-label);
    font-size: 10px;
    color: var(--text-sub);
    font-weight: 600;
    flex: 0 0 70px;
  }
  /* 名前は強調 (上段に大きく) */
  .kaiin-all-list-table td[data-label="名前"] {
    font-size: 15px !important;
    font-weight: 700 !important;
    border-bottom: 1px dashed var(--border);
    padding-bottom: 6px;
    margin-bottom: 4px;
  }
  .kaiin-all-list-table td[data-label="名前"]::before { font-size: 11px; }
  /* 金額も右寄せ太字で目立たせる */
  .kaiin-all-list-table td[data-label="金額"] {
    font-weight: 700 !important;
    color: #111;
  }
  /* 該当なし行は中央寄せ */
  .kaiin-all-list-table td[colspan] {
    text-align: center !important;
    justify-content: center;
  }
  .kaiin-all-list-table td[colspan]::before { display: none; }
}
