/* ==========================================
   NiraiDesk style.css — Coral Sunset Premium
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c:wght@300;400;500;700;800&family=Noto+Sans+JP:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #c06a08;
  --primary-dark: #9a5406;
  --primary-light: #fff6ee;
  --primary-hover: #d07818;
  --accent: #0891b2;
  --accent-light: #f0faff;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --warning: #c08a20;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --gray-50: #fdfaf6;
  --gray-100: #f5f0ea;
  --gray-200: #e8ddd0;
  --gray-300: #d4c4b0;
  --gray-400: #b0a090;
  --gray-500: #8a7a6a;
  --gray-600: #6a5a4a;
  --gray-700: #4a3a2a;
  --gray-800: #2a1a0e;
  --gray-900: #1a0e04;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-pill: 22px;
  --shadow: 0 1px 4px rgba(80,40,10,0.05);
  --shadow-md: 0 4px 14px rgba(80,40,10,0.08);
  --shadow-lg: 0 8px 24px rgba(80,40,10,0.12);
  --header-h: 54px;
  --nav-h: 58px;
  --font: 'M PLUS Rounded 1c', 'Noto Sans JP', sans-serif;
  --bg: #fdfaf6;
  --card: #ffffff;
  --border: rgba(180,140,100,0.1);
  --border-strong: rgba(180,140,100,0.18);
  --header-from: #2d1a0e;
  --header-mid: #4a2a14;
  --header-to: #6b3d1e;
  --header-glow: rgba(255,180,80,0.12);
  --header-line: rgba(255,180,80,0.25);
}

/* === テーマカラー === */
[data-theme="sand"] {
  /* デフォルト — 砂浜・暖色（:rootと同じ） */
}

[data-theme="ocean"] {
  --primary: #0f4c75;
  --primary-dark: #0a3a5c;
  --primary-light: #f0f7ff;
  --primary-hover: #1a6091;
  --accent: #0891b2;
  --accent-light: #f0faff;
  --gray-50: #f5f8fb;
  --gray-100: #eaf0f6;
  --gray-200: #d0dce8;
  --gray-300: #b0c0d4;
  --gray-400: #8098b0;
  --gray-500: #607890;
  --gray-600: #405870;
  --gray-700: #283848;
  --gray-800: #141e2a;
  --gray-900: #0a1018;
  --bg: #f5f8fb;
  --border: rgba(40,80,140,0.1);
  --border-strong: rgba(40,80,140,0.18);
  --shadow: 0 1px 4px rgba(10,30,60,0.05);
  --shadow-md: 0 4px 14px rgba(10,30,60,0.08);
  --shadow-lg: 0 8px 24px rgba(10,30,60,0.12);
  --header-from: #071e30;
  --header-mid: #0f3555;
  --header-to: #1a5580;
  --header-glow: rgba(80,180,255,0.12);
  --header-line: rgba(80,180,255,0.25);
}

[data-theme="forest"] {
  --primary: #2d6b4e;
  --primary-dark: #1e4f38;
  --primary-light: #f0f9f4;
  --primary-hover: #388f63;
  --accent: #0891b2;
  --accent-light: #f0faff;
  --gray-50: #f6faf7;
  --gray-100: #ecf4ee;
  --gray-200: #d0e4d6;
  --gray-300: #a8c8b4;
  --gray-400: #80a890;
  --gray-500: #608870;
  --gray-600: #406850;
  --gray-700: #284030;
  --gray-800: #142018;
  --gray-900: #0a100c;
  --bg: #f6faf7;
  --border: rgba(40,100,60,0.1);
  --border-strong: rgba(40,100,60,0.18);
  --shadow: 0 1px 4px rgba(10,40,20,0.05);
  --shadow-md: 0 4px 14px rgba(10,40,20,0.08);
  --shadow-lg: 0 8px 24px rgba(10,40,20,0.12);
  --header-from: #0e2818;
  --header-mid: #1a4030;
  --header-to: #2d6048;
  --header-glow: rgba(80,220,140,0.12);
  --header-line: rgba(80,220,140,0.25);
}

[data-theme="coral"] {
  --primary: #d4546a;
  --primary-dark: #b03a50;
  --primary-light: #fff0f3;
  --primary-hover: #e0687c;
  --accent: #0891b2;
  --accent-light: #f0faff;
  --gray-50: #fcf7f8;
  --gray-100: #f6edef;
  --gray-200: #e8d4d8;
  --gray-300: #d4b0b8;
  --gray-400: #b08890;
  --gray-500: #906870;
  --gray-600: #704850;
  --gray-700: #482830;
  --gray-800: #281418;
  --gray-900: #180a0c;
  --bg: #fcf7f8;
  --border: rgba(180,60,80,0.1);
  --border-strong: rgba(180,60,80,0.18);
  --shadow: 0 1px 4px rgba(80,20,30,0.05);
  --shadow-md: 0 4px 14px rgba(80,20,30,0.08);
  --shadow-lg: 0 8px 24px rgba(80,20,30,0.12);
  --header-from: #2e0e16;
  --header-mid: #501a2a;
  --header-to: #803048;
  --header-glow: rgba(255,120,160,0.12);
  --header-line: rgba(255,120,160,0.25);
}

[data-theme="night"] {
  --primary: #8878ff;
  --primary-dark: #6658dd;
  --primary-light: #1e1e38;
  --primary-hover: #9a8eff;
  --accent: #38bdf8;
  --accent-light: #0f1928;
  --gray-50: #1a1a2e;
  --gray-100: #22223a;
  --gray-200: #323252;
  --gray-300: #505074;
  --gray-400: #7070a0;
  --gray-500: #9898b8;
  --gray-600: #b8b8d4;
  --gray-700: #d4d4e8;
  --gray-800: #ececf6;
  --gray-900: #f8f8fc;
  --bg: #12121e;
  --card: #1e1e32;
  --border: rgba(130,130,210,0.15);
  --border-strong: rgba(130,130,210,0.28);
  --shadow: 0 1px 4px rgba(0,0,20,0.3);
  --shadow-md: 0 4px 14px rgba(0,0,20,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,20,0.5);
  --header-from: #0a0a18;
  --header-mid: #141428;
  --header-to: #1e1e38;
  --header-glow: rgba(130,110,255,0.18);
  --header-line: rgba(130,110,255,0.35);
  --success-light: #0a2014;
  --warning-light: #201a0a;
  --danger-light: #200a0a;
}

[data-theme="tida"] {
  --primary: #e8760a;
  --primary-dark: #c06008;
  --primary-light: #fff8f0;
  --primary-hover: #f08820;
  --accent: #0891b2;
  --accent-light: #f0faff;
  --gray-50: #fefcf6;
  --gray-100: #faf4e8;
  --gray-200: #f0e0c4;
  --gray-300: #dcc4a0;
  --gray-400: #c0a480;
  --gray-500: #a08060;
  --gray-600: #786040;
  --gray-700: #504028;
  --gray-800: #302010;
  --gray-900: #201008;
  --bg: #fefcf6;
  --border: rgba(200,120,20,0.1);
  --border-strong: rgba(200,120,20,0.18);
  --shadow: 0 1px 4px rgba(80,40,0,0.05);
  --shadow-md: 0 4px 14px rgba(80,40,0,0.08);
  --shadow-lg: 0 8px 24px rgba(80,40,0,0.12);
  --header-from: #301a04;
  --header-mid: #502e0a;
  --header-to: #804a14;
  --header-glow: rgba(255,180,40,0.15);
  --header-line: rgba(255,180,40,0.3);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--gray-800);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* --- Header --- */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  background: linear-gradient(160deg, var(--header-from) 0%, var(--header-mid) 40%, var(--header-to) 100%);
  color: #fff;
  display: flex; align-items: center;
  padding: 0 16px;
  box-shadow: 0 2px 12px rgba(40,20,5,0.25);
  overflow: hidden;
}
.app-header::before {
  content: '';
  position: absolute; top: -40px; right: -30px;
  width: 160px; height: 160px;
  background: radial-gradient(circle, var(--header-glow) 0%, transparent 70%);
  pointer-events: none;
}
.app-header::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--header-line), transparent);
}
.header-left { display: flex; align-items: center; gap: 12px; position: relative; }
.app-title {
  font-size: 18px; font-weight: 700; letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff, #ffd4a0);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.shop-select {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius);
  padding: 5px 12px;
  font-size: 12px;
  font-family: var(--font);
  outline: none;
}
.shop-select option { color: var(--gray-800); background: #fff; }

/* --- Bottom Navigation --- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  box-shadow: 0 -2px 12px rgba(80,40,10,0.06);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.bottom-nav::-webkit-scrollbar { display: none; }
.nav-item {
  flex: 0 0 auto; min-width: 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-decoration: none;
  color: var(--gray-400);
  font-size: 9px; font-weight: 600;
  transition: color .2s;
  padding: 4px 6px;
  position: relative;
}
.nav-item.active { color: var(--primary); }
.nav-item.active::before {
  content: '';
  position: absolute; top: -1px;
  width: 20px; height: 2.5px;
  background: linear-gradient(90deg, var(--primary), var(--primary-hover));
  border-radius: 2px;
}
.nav-icon { font-size: 18px; margin-bottom: 1px; }
.nav-label { font-weight: 600; }

/* --- Main Content --- */
.main-content {
  margin-top: var(--header-h);
  margin-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding: 14px;
  max-width: 960px;
  margin-left: auto; margin-right: auto;
}

/* --- Card --- */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.card h3 { font-size: 12px; margin-bottom: 10px; color: var(--gray-500); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.card h4 { font-size: 14px; margin: 16px 0 8px; color: var(--gray-700); }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 10px 22px;
  border: none; border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: var(--font);
  transition: all .2s;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, #b85a08, #d07018);
  color: #fff;
  box-shadow: 0 2px 10px rgba(180,90,8,0.25);
}
.btn-primary:hover { box-shadow: 0 4px 18px rgba(180,90,8,0.35); transform: translateY(-1px); }
.btn-secondary { background: var(--card); color: var(--gray-600); border: 1px solid var(--border-strong); }
.btn-secondary:hover { background: var(--gray-50); }
.btn-small { padding: 6px 14px; font-size: 12px; }
.btn-icon { background: none; border: none; font-size: 18px; cursor: pointer; padding: 4px 8px; border-radius: var(--radius); transition: background .15s; }
.btn-icon:hover { background: var(--gray-100); }
.btn-group { display: flex; gap: 8px; margin-top: 12px; }

/* --- Form elements --- */
input[type="text"], input[type="tel"], input[type="url"], input[type="number"], input[type="date"], select, textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 14px; font-family: var(--font);
  background: var(--card); color: var(--gray-800);
  outline: none; transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(192,106,8,0.08); }
textarea { resize: vertical; }

/* --- Confirm Grid --- */
.confirm-grid { display: grid; gap: 8px; }
.confirm-row { display: flex; align-items: center; gap: 8px; }
.confirm-row label { min-width: 80px; font-size: 12px; font-weight: 700; color: var(--gray-500); flex-shrink: 0; }
.confirm-row input, .confirm-row select { flex: 1; max-width: 300px; }

/* --- Status Badge --- */
.status-badge { display: inline-block; padding: 2px 9px; border-radius: 8px; color: #fff; font-size: 10px; font-weight: 700; }

/* --- LINE Input --- */
#line-input { width: 100%; font-size: 13px; line-height: 1.6; font-family: monospace, var(--font); background: var(--gray-50); margin-bottom: 8px; }

/* --- Participants Table --- */
.p-input { padding: 4px 6px !important; font-size: 12px !important; }
.eq-cell { font-weight: 600; color: var(--primary-dark); font-size: 12px; }

/* --- Options --- */
.option-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--gray-100); }
.option-row label { flex: 1; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.qty-input { width: 60px !important; text-align: center; }

/* --- Price Summary --- */
.price-summary { background: var(--primary-light); border-radius: var(--radius); padding: 12px; margin: 12px 0; border: 1px solid rgba(192,106,8,0.08); }
.price-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.price-total { font-weight: 700; font-size: 16px; border-top: 2px solid var(--primary); padding-top: 8px; margin-top: 4px; color: var(--primary-dark); }

/* --- Done --- */
.done-message { text-align: center; padding: 24px 0; }
.done-icon { font-size: 48px; }
.done-message h3 { margin: 12px 0 8px; }

/* --- Page Header --- */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.page-header h2 { font-size: 18px; font-weight: 700; }
.header-actions { display: flex; gap: 4px; }
.header-actions .btn.active { background: var(--primary); color: #fff; }

/* --- Date Navigation --- */
.date-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; background: var(--card); padding: 8px 12px; border-radius: var(--radius-lg); box-shadow: var(--shadow); border: 1px solid var(--border); }
.date-nav input[type="date"] { flex: 1; max-width: 180px; }

/* --- Time Group --- */
.time-group { margin-bottom: 16px; }
.time-header { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 2px solid var(--primary); margin-bottom: 8px; }
.time-header h3 { font-size: 16px; color: var(--primary-dark); }
.slot-info { font-size: 12px; color: var(--gray-500); }
.slot-low { color: var(--danger); font-weight: 700; }

/* --- Booking Card --- */
.booking-card { background: var(--card); border-radius: var(--radius-lg); padding: 11px 14px; margin-bottom: 6px; box-shadow: var(--shadow); cursor: pointer; transition: all .15s; border: 1px solid var(--border); border-left: 3px solid var(--primary); }
.booking-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.card-header { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.shop-tag { font-size: 10px; padding: 1px 6px; border: 1px solid; border-radius: 8px; font-weight: 600; }
.course-name { font-size: 12px; color: var(--gray-500); }
.card-body { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-main { flex: 1; }
.rep-name { font-weight: 600; font-size: 15px; margin-right: 6px; }
.people-count { font-size: 13px; color: var(--gray-500); }
.card-sub { display: flex; gap: 4px; }
.tag-pickup, .tag-local, .tag-medical, .tag-option, .tag-campaign { font-size: 10px; padding: 2px 7px; border-radius: 8px; font-weight: 600; background: var(--gray-100); color: var(--gray-600); }
.tag-medical { background: var(--danger-light); color: var(--danger); }
.tag-medical-danger { font-size: 10px; padding: 2px 7px; border-radius: 8px; font-weight: 700; background: var(--danger-light); color: var(--danger); }
.tag-campaign { background: #fef3c7; color: #92400e; }
.card-price { font-weight: 700; color: var(--primary-dark); font-size: 14px; }

/* 店舗タグ（帳票内 小サイズ） */
.shop-tag-sm { display: inline-block; font-size: 9px; font-weight: 700; padding: 1px 5px; border: 1.5px solid; border-radius: 6px; vertical-align: middle; line-height: 1.3; white-space: nowrap; }

/* --- Calendar --- */
.calendar { background: var(--card); border-radius: var(--radius-lg); padding: 12px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.cal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { text-align: center; font-size: 10px; font-weight: 700; color: var(--gray-400); padding: 4px 0; }
.cal-cell { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: var(--radius); cursor: pointer; transition: background .1s; position: relative; }
.cal-cell:hover { background: var(--gray-100); }
.cal-empty { cursor: default; }
.cal-day { font-size: 13px; font-weight: 500; }
.cal-count { font-size: 9px; color: var(--primary-dark); font-weight: 600; }
.cal-selected { background: var(--primary-light) !important; }
.cal-today .cal-day { background: var(--primary); color: #fff; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.cal-has-booking { background: var(--primary-light); }

/* --- Empty State --- */
.empty-state { text-align: center; padding: 48px 16px; color: var(--gray-400); }
.empty-state p { margin-bottom: 16px; font-size: 15px; }

/* --- Equipment Table --- */
.equipment-table-wrap { overflow-x: auto; }
.equipment-table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
.equipment-table th { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); color: #fff; padding: 8px 6px; font-size: 11px; text-align: center; font-weight: 700; }
.equipment-table td { padding: 6px; border-bottom: 1px solid var(--gray-100); text-align: center; }
.equipment-table tr:nth-child(even) { background: var(--gray-50); }

/* --- Settings --- */
.settings-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.settings-table th { background: var(--gray-100); padding: 6px 10px; text-align: left; font-size: 11px; color: var(--gray-500); font-weight: 700; }
.settings-table td { padding: 8px 10px; border-bottom: 1px solid var(--gray-100); }
.hint { font-size: 11px; color: var(--gray-400); margin-top: 8px; }

/* --- Modal --- */
.modal-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(30,15,5,.55); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-content { background: var(--card); border-radius: var(--radius-lg); max-width: 480px; width: 100%; max-height: 80vh; overflow-y: auto; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 15px; font-weight: 700; }
.btn-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--gray-400); border-radius: var(--radius); padding: 4px 8px; transition: background .15s; }
.btn-close:hover { background: var(--gray-100); }
.modal-body { padding: 16px; }
.modal-body p { margin-bottom: 6px; font-size: 13px; }
.modal-body h4 { font-size: 14px; margin: 12px 0 6px; font-weight: 700; }
.modal-body ul { margin-left: 16px; font-size: 13px; }
.modal-body li { margin-bottom: 4px; }

/* --- Utility --- */
.text-warning { color: var(--warning); font-weight: 700; }
/* ★ v28: 持病・注意テキストは赤、注意喚起マークは黄色背景 */
.text-danger { color: var(--danger); font-weight: 700; }
.medical-alert-icon { background: #fef08a; color: #92400e; padding: 1px 5px; border-radius: 4px; font-size: 13px; font-weight: 700; }
.alert-box-danger { background: var(--danger-light); color: var(--danger); padding: 8px 12px; border-radius: var(--radius); font-size: 13px; font-weight: 700; margin-top: 8px; border-left: 3px solid var(--danger); }
.date-label { font-size: 14px; color: var(--gray-500); }

/* --- Responsive: Tablet+ --- */
@media (min-width: 768px) {
  .main-content { padding: 16px 24px; }
  .confirm-row label { min-width: 120px; }
  .booking-card { padding: 12px 16px; }
  .cal-cell { aspect-ratio: auto; padding: 8px 4px; min-height: 60px; }
  .cal-day { font-size: 14px; }
  .cal-count { font-size: 10px; }
}

/* --- Responsive: Desktop --- */
@media (min-width: 1024px) {
  .bottom-nav { position: fixed; top: var(--header-h); left: 0; bottom: 0; width: 76px; height: auto; flex-direction: column; border-top: none; border-right: 1px solid var(--border); padding-top: 8px; box-shadow: none; overflow-x: visible; }
  .nav-item { padding: 12px 0; border-radius: 0; min-width: auto; flex: 0 0 auto; }
  .nav-item.active::before { top: 50%; left: -1px; right: auto; width: 3px; height: 20px; transform: translateY(-50%); border-radius: 0 2px 2px 0; }
  .nav-label { font-size: 9px; }
  .main-content { margin-left: 76px; margin-bottom: 0; max-width: 1000px; }
}

/* ==========================================
   拡張モーダル
   ========================================== */
.modal-large { max-width: 860px; }
.detail-section { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--gray-100); }
.detail-section:last-of-type { border-bottom: none; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.detail-item { font-size: 13px; }
.detail-label { font-size: 11px; color: var(--gray-400); display: block; font-weight: 500; }
.detail-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.detail-row label { min-width: 80px; font-size: 12px; font-weight: 700; color: var(--gray-500); }
.detail-row select, .detail-row input { flex: 1; max-width: 220px; }
.alert-box { background: var(--warning-light); color: #7c5a10; padding: 8px 12px; border-radius: var(--radius); font-size: 13px; font-weight: 700; margin-top: 8px; border-left: 3px solid var(--warning); }

.team-suggestion { background: var(--gray-50); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; }
.team-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.team-note { font-size: 12px; color: var(--primary-dark); margin-top: 4px; }
.team-assign { margin-top: 8px; }

.template-buttons { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.template-output { width: 100%; font-size: 12px; line-height: 1.6; font-family: var(--font); background: var(--gray-50); margin-bottom: 4px; }

.detail-actions { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.btn-danger-outline { background: none; border: 1px solid var(--danger); color: var(--danger); border-radius: var(--radius-pill); padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: var(--font); }
.btn-danger-outline:hover { background: var(--danger-light); }
.btn-danger { background: var(--danger, #e74c3c); color: #fff; border: none; border-radius: var(--radius-pill); padding: 10px 20px; font-size: 14px; font-weight: 700; cursor: pointer; font-family: var(--font); }
.btn-danger:hover { background: #c0392b; }
.btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }
.change-fund-chip { display:inline-flex; align-items:center; justify-content:center; width:44px; height:44px; border-radius:50%; border:2px solid var(--gray-300); background:var(--bg-card, #fff); color:var(--gray-500); font-size:16px; font-weight:700; cursor:pointer; font-family:var(--font); transition:all 0.15s; }
.change-fund-chip:hover { border-color:var(--primary); color:var(--primary); }
.change-fund-chip.active { border-color:var(--success); background:var(--success-light); color:var(--success); }
.text-success { color: var(--success); font-weight: 700; }

.eq-time-card { margin-bottom: 16px; }
.eq-time-card h3 { color: var(--primary-dark); border-bottom: 2px solid var(--primary); padding-bottom: 6px; }
.group-first td { border-top: 2px solid var(--gray-300); }
.equipment-table td small { color: var(--gray-400); font-size: 10px; }

.summary-grid { display: grid; gap: 8px; }
.summary-item { display: flex; align-items: flex-start; gap: 8px; }
.summary-item label { min-width: 90px; font-size: 12px; font-weight: 700; color: var(--gray-500); padding-top: 2px; }
.count-tag { display: inline-block; background: var(--primary-light); color: var(--primary-dark); padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 700; margin: 2px; }

/* --- 印刷用ヘッダー・精算帳票（画面非表示） --- */
.print-header { display: none; }
.print-billing-sheet { display: none; }

/* --- 印刷用 --- */
@media print {
  .print-header {
    display: block !important;
    padding: 0 0 12px;
    margin-bottom: 16px;
    border-bottom: 2px solid #333;
  }
  .print-header-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
  }
  .print-title {
    font-size: 20px;
    font-weight: 800;
    color: #333;
  }
  .print-shop {
    font-size: 14px;
    font-weight: 600;
    color: #555;
  }
  .print-header-info {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 4px;
  }
  .print-tab-name {
    font-size: 18px;
    font-weight: 700;
    color: #000;
  }
  .print-date {
    font-size: 16px;
    font-weight: 600;
    color: #333;
  }
  .app-header, .bottom-nav, .page-header, #btn-print-invoice, #btn-print-eq, .btn-group, .billing-actions, .billing-add-option, .billing-back-btn, .billing-nav-btns, .op-share-bar, .op-date-nav { display: none !important; }
  .main-content { margin: 0; padding: 0; }
  .card, .invoice-section { box-shadow: none; border: 1px solid #ccc; page-break-inside: avoid; }
  .invoice-table, .equipment-table { font-size: 11px; }
  .invoice-table th, .equipment-table th { background: var(--primary-dark) !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tab-bar { display: none !important; }
  .change-calc-wrap { display: none !important; }
  .print-hide, .pdf-hide { display: none !important; }

  /* === 精算タブ印刷: 画面UIを隠して印刷用シートを表示 === */
  .billing-summary-bar,
  .billing-list,
  .billing-card,
  .billing-detail-header { display: none !important; }

  .print-billing-sheet {
    display: block !important;
  }

  /* 精算タブ印刷時は汎用ヘッダーを非表示（精算シート独自ヘッダーを使う） */
  .print-header.print-header-hide { display: none !important; }

  /* --- 精算帳票スタイル --- */
  .pbs-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-bottom: 8px;
    margin-bottom: 12px;
    border-bottom: 3px double #333;
  }
  .pbs-header-left { display: flex; align-items: baseline; gap: 12px; }
  .pbs-title { font-size: 22px; font-weight: 800; color: #000; margin: 0; }
  .pbs-shop { font-size: 13px; color: #555; font-weight: 600; }
  .pbs-header-right { text-align: right; }
  .pbs-date { font-size: 18px; font-weight: 700; color: #000; display: block; }
  .pbs-summary { font-size: 13px; color: #555; }

  .pbs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    margin-bottom: 16px;
  }
  .pbs-table th {
    background: #333 !important;
    color: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    padding: 5px 4px;
    font-size: 9px;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    border: 1px solid #333;
  }
  .pbs-table td {
    padding: 6px 5px;
    border: 1px solid #bbb;
    vertical-align: middle;
  }
  .pbs-table tbody tr:nth-child(even) { background: #f8f8f8; }
  .pbs-center { text-align: center; }
  .pbs-right { text-align: right; }
  .pbs-bold { font-weight: 700; }
  .pbs-name { font-weight: 700; font-size: 12px; white-space: nowrap; }
  .shop-tag-sm { font-size: 7px; padding: 0 3px; border-width: 1px; }
  .pbs-discount { color: #c00; }
  .pbs-col-opt { min-width: 80px; }
  .pbs-table td:nth-child(7) { white-space: nowrap; font-size: 9px; vertical-align: top; text-align: right; }
  .pbs-due-cell { font-size: 13px; background: #fff8e0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pbs-method-cell { min-width: 70px; }
  .pbs-check-cell { text-align: center; font-size: 16px; min-width: 28px; }
  .pbs-total-row td {
    border-top: 2px solid #333;
    padding-top: 8px;
    font-size: 12px;
  }
  .pbs-grand { font-size: 14px; }

  /* 支払方法内訳 */
  .pbs-payment-summary { margin-top: 16px; }
  .pbs-payment-summary h3 { font-size: 12px; font-weight: 700; margin-bottom: 6px; color: #333; }
  .pbs-pay-table { width: 260px; border-collapse: collapse; }
  .pbs-pay-table td { padding: 6px 8px; font-size: 12px; border-bottom: 1px solid #ccc; }
  .pbs-pay-table td:first-child { width: 100px; font-weight: 600; }
  .pbs-write-line { min-width: 120px; border-bottom: 1px dotted #999 !important; }
  .pbs-pay-total td { border-top: 2px solid #333; font-weight: 700; font-size: 13px; }

  /* メモ欄 */
  .pbs-memo { margin-top: 16px; }
  .pbs-memo h3 { font-size: 12px; font-weight: 700; margin-bottom: 6px; color: #333; }
  .pbs-memo-lines {
    height: 60px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: repeating-linear-gradient(
      transparent,
      transparent 19px,
      #e0e0e0 19px,
      #e0e0e0 20px
    );
  }
}

/* ==========================================
   帳票タブ
   ========================================== */
.tab-bar { display: flex; gap: 2px; background: var(--gray-100); border-radius: var(--radius-lg); padding: 3px; margin-bottom: 12px; }
.tab-btn { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border: none; border-radius: var(--radius); background: transparent; color: var(--gray-400); font-size: 10px; font-weight: 700; cursor: pointer; transition: all .15s; font-family: var(--font); }
.tab-btn.tab-active { background: var(--card); color: var(--primary); box-shadow: var(--shadow); }
.tab-icon { font-size: 18px; margin-bottom: 2px; }

.invoice-section { margin-bottom: 16px; }
.invoice-table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
.invoice-table th { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); color: #fff; padding: 6px 8px; font-size: 11px; text-align: center; font-weight: 700; }
.invoice-table td { padding: 6px 8px; border-bottom: 1px solid var(--gray-100); text-align: center; }
/* ★ v29: 注意事項・メモ列は折り返し許可（段取りPDF用） */
#alert-table td { white-space: normal; word-break: break-word; }
.team-group-block .invoice-table td:last-child { white-space: normal; word-break: break-word; }
.invoice-table.compact td { padding: 4px 6px; font-size: 12px; }
.invoice-table tr:nth-child(even) { background: var(--gray-50); }
.total-row td { border-top: 2px solid var(--gray-700); font-weight: 700; }
.text-right { text-align: right !important; }
.time-title { color: var(--primary-dark); border-bottom: 2px solid var(--primary); padding-bottom: 4px; margin-bottom: 8px; font-size: 15px; }
.brand-sub { color: var(--gray-400); font-size: 10px; }
.date-input-sm { width: 140px !important; font-size: 13px; }
.inline-input { border: 1px solid var(--border-strong) !important; padding: 4px 6px !important; font-size: 12px !important; width: 120px !important; border-radius: var(--radius) !important; }

.summary-section { background: var(--gray-50); border-radius: var(--radius); padding: 12px; }
.summary-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.summary-row label { min-width: 90px; font-size: 12px; font-weight: 700; color: var(--gray-500); }

.pickup-summary { display: flex; gap: 16px; align-items: center; padding: 8px 12px; background: var(--primary-light); border-radius: var(--radius); margin-bottom: 12px; font-size: 14px; border: 1px solid rgba(192,106,8,0.08); }
.tag-full { background: var(--danger); color: #fff; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; }

.op-overview { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.op-stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; text-align: center; min-width: 70px; }
.op-num { display: block; font-size: 24px; font-weight: 700; color: var(--primary-dark); }
.op-label { font-size: 11px; color: var(--gray-400); }
.time-block { margin-bottom: 12px; }
.time-block h4 { font-size: 14px; color: var(--primary-dark); margin-bottom: 4px; }

.billing-card { background: var(--card); border-radius: var(--radius-lg); margin-bottom: 12px; box-shadow: var(--shadow-md); border: 1px solid var(--border); overflow: hidden; transition: box-shadow 0.2s; }
.billing-card:not(.billing-paid) { border-top: 3px solid var(--primary); }
.billing-card.billing-paid { border-top: 3px solid var(--success); opacity: 0.88; }
.billing-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: linear-gradient(135deg, var(--gray-50), var(--primary-light)); border-bottom: 1px solid var(--border); }
.billing-header-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.billing-name { font-weight: 700; font-size: 15px; color: var(--gray-800); }
.billing-meta { font-size: 12px; color: var(--gray-500); }
.billing-time { color: var(--gray-400); font-size: 12px; margin: 0 8px; }
.billing-people { font-size: 12px; color: var(--gray-500); }
.billing-course { font-size: 12px; color: var(--primary-dark); margin-left: 4px; }
.billing-status { font-size: 12px; font-weight: 700; white-space: nowrap; }
.billing-status.paid { color: var(--success); }
.billing-status.unpaid { color: var(--warning); }
.billing-body { padding: 14px 16px; }
.billing-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 13px; }
.billing-row-label { font-size: 12px; color: var(--gray-600); font-weight: 600; }
.billing-row label { font-size: 12px; color: var(--gray-500); font-weight: 700; }
.billing-row-discount { color: var(--danger); }
.billing-row-discount .billing-row-label { color: var(--warning); }
.billing-row-prepaid { border-top: 1px solid var(--gray-100); padding-top: 10px; margin-top: 4px; }
.billing-prepaid-group { display: flex; gap: 6px; align-items: center; }
.billing-prepaid-group select { width: auto; min-width: 80px; padding: 5px 8px; font-size: 12px; }
.billing-total-row { display: flex; justify-content: space-between; padding: 10px 0; margin: 6px 0; border-top: 2px solid var(--primary); font-weight: 700; font-size: 16px; }
.billing-total { color: var(--primary-dark); }
.billing-local { background: linear-gradient(135deg, var(--primary-light), #fff8f0); padding: 10px 12px; border-radius: var(--radius); margin: 6px 0; border: 1px solid rgba(192,106,8,0.1); }
.billing-local .local-due { font-size: 18px; font-weight: 800; color: var(--primary-dark); }
.billing-add-option { padding: 4px 0; }
.billing-add-option select { font-size: 12px; padding: 6px 10px; border-radius: var(--radius-pill); border: 1px dashed var(--border-strong); background: var(--gray-50); color: var(--gray-500); cursor: pointer; }
.billing-actions { display: flex; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--gray-100); }
.prepaid-input { width: 100px !important; text-align: right; }

/* --- 精算一覧（トップ画面） --- */
.billing-summary-bar { background: linear-gradient(135deg, var(--primary-light), #fff8f0); border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 12px; border: 1px solid rgba(192,106,8,0.1); }
.billing-summary-bar > :first-child { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.billing-summary-progress { display: flex; align-items: baseline; gap: 6px; }
.billing-summary-count { font-size: 24px; font-weight: 800; color: var(--primary-dark); }
.billing-summary-label { font-size: 12px; color: var(--gray-500); font-weight: 600; }
.billing-summary-amount { display: flex; align-items: baseline; gap: 4px; margin-bottom: 8px; }
.billing-summary-paid { font-size: 16px; font-weight: 700; color: var(--primary-dark); }
.billing-summary-total { font-size: 13px; color: var(--gray-400); }
.billing-progress-bar { height: 6px; background: var(--gray-200); border-radius: 3px; overflow: hidden; }
.billing-progress-fill { height: 100%; background: linear-gradient(90deg, var(--success), #22c55e); border-radius: 3px; transition: width 0.3s; }

.billing-list { display: flex; flex-direction: column; gap: 4px; }
.billing-list-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow); border: 1px solid var(--border); cursor: pointer; transition: all 0.15s; }
.billing-list-item:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.billing-list-item:active { transform: scale(0.99); }
.billing-list-paid { opacity: 0.75; }
.billing-list-paid .billing-list-name { text-decoration: line-through; text-decoration-color: var(--gray-300); }
.billing-list-status { font-size: 18px; flex-shrink: 0; }
.billing-list-main { flex: 1; min-width: 0; }
.billing-list-name { font-size: 15px; font-weight: 700; color: var(--gray-800); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.billing-list-meta { font-size: 11px; color: var(--gray-500); margin-top: 2px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.billing-list-right { text-align: right; flex-shrink: 0; }
.billing-list-price { font-size: 15px; font-weight: 700; color: var(--primary-dark); }
.billing-list-method { font-size: 10px; color: var(--gray-400); margin-top: 2px; }
.billing-list-arrow { font-size: 20px; color: var(--gray-300); flex-shrink: 0; font-weight: 300; }

/* --- 精算詳細（ヘッダー） --- */
.billing-detail-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.billing-detail-pos { font-size: 12px; color: var(--gray-400); font-weight: 600; }
.billing-nav-btns { display: flex; justify-content: center; gap: 8px; margin-top: 12px; }

/* --- 精算グループ分け --- */
.tag-split { display: inline-block; background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 4px; border: 1px solid rgba(245,158,11,0.25); }
.billing-list-sub { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 44px; font-size: 12px; color: var(--gray-600); background: var(--bg-card, #f8f4ef); border-left: 3px solid var(--primary-light); margin: -1px 0 0 0; }
.billing-sub-status { flex-shrink: 0; }
.billing-sub-label { flex: 1; font-weight: 600; }
.billing-sub-amount { font-weight: 700; color: var(--primary-dark); }
.billing-sub-method { font-size: 11px; color: var(--gray-400); margin-left: 4px; }

.billing-group-toggle { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; margin-top: 8px; border-top: 1px dashed var(--border); }
.billing-group-toggle-label { font-size: 13px; font-weight: 700; color: var(--gray-600); }
.billing-group-toggle-btns { display: flex; gap: 6px; }
.billing-mode-btn { font-size: 12px; padding: 6px 14px; border-radius: var(--radius); border: 1.5px solid var(--border-strong); background: var(--card); color: var(--gray-600); cursor: pointer; transition: all 0.15s; }
.billing-mode-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }

.billing-split-container { margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }

.billing-group-card { background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; transition: all 0.2s; }
.billing-group-card:not(.billing-group-paid) { border-left: 4px solid var(--primary); }
.billing-group-paid { border-left: 4px solid var(--success); opacity: 0.85; }

.billing-group-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: linear-gradient(135deg, rgba(192,106,8,0.06), rgba(192,106,8,0.02)); border-bottom: 1px solid var(--border); }
.billing-group-title { font-size: 14px; font-weight: 700; color: var(--primary-dark); }
.billing-group-title-wrap { display: flex; align-items: center; gap: 6px; flex: 1; }
.billing-group-key { font-size: 13px; font-weight: 800; color: var(--primary); background: var(--primary-light); width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 50%; flex-shrink: 0; }
.billing-group-label-input { font-size: 16px; font-weight: 700; color: var(--primary-dark); background: transparent; border: none; border-bottom: 1.5px dashed var(--border-strong); padding: 2px 4px; min-width: 60px; max-width: 140px; outline: none; transition: border-color 0.2s; font-family: inherit; }
.billing-group-label-input:focus { border-bottom-color: var(--primary); background: rgba(255,255,255,0.5); }
.billing-group-label-input:disabled { border-bottom: none; opacity: 0.8; }
.billing-group-count { font-size: 12px; color: var(--gray-500); white-space: nowrap; }
.billing-group-status { font-size: 16px; }

.billing-group-members { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 14px; }
.billing-group-member { display: inline-flex; align-items: center; gap: 3px; background: var(--bg-card, #f8f4ef); border: 1px solid var(--border); border-radius: 4px; padding: 2px 8px; font-size: 12px; color: var(--gray-600); transition: all 0.15s; }
.billing-group-member.movable { cursor: pointer; border-style: dashed; }
.billing-group-member.movable:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow); }
.billing-group-member.movable:active { transform: scale(0.96); }
.member-move-icon { font-size: 10px; opacity: 0.4; margin-left: 2px; }
.billing-group-member.movable:hover .member-move-icon { opacity: 1; }
.billing-group-empty { font-size: 12px; color: var(--gray-400); font-style: italic; }

.billing-group-amounts { padding: 0 14px 8px; }
.billing-group-amounts .billing-row { padding: 4px 0; }

.billing-group-card .billing-row { padding: 4px 14px; }
.billing-group-card .billing-row-prepaid { padding: 4px 14px; }
.billing-group-card .billing-actions { padding: 10px 14px; }
.billing-group-card .billing-local { padding: 4px 14px; }

.billing-group-card .grp-change-calc-wrap { margin: 4px 14px 8px; padding: 10px 12px; background: linear-gradient(135deg, #fefbe8, #fef9e7); border: 1px solid rgba(234,179,8,0.15); border-radius: var(--radius-lg); }

.billing-split-summary { padding: 12px 14px; background: linear-gradient(135deg, rgba(192,106,8,0.08), rgba(192,106,8,0.03)); border-radius: var(--radius-lg); border: 1px solid var(--border); margin-top: 4px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--gray-600); }
.billing-split-summary strong { color: var(--primary-dark); }

.billing-opt-allocation { padding: 10px 14px; background: var(--bg-card, #f8f4ef); border-radius: var(--radius-lg); border: 1px solid var(--border); margin-top: 8px; }
.billing-opt-allocation-label { font-size: 12px; font-weight: 700; color: var(--gray-600); display: block; margin-bottom: 6px; }
.billing-opt-alloc-row { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 4px 0; flex-wrap: wrap; }
.billing-opt-alloc-row.alloc-ok { color: var(--gray-500); }
.billing-opt-alloc-row.alloc-warn { color: var(--danger); }
.alloc-diff { font-weight: 700; }
.alloc-check { color: var(--success); }

.grp-opt-share-row { align-items: center; }
.grp-opt-share-input { border: 1.5px solid var(--border-strong); border-radius: var(--radius); padding: 4px 6px; background: var(--card); color: var(--primary-dark); font-weight: 600; font-family: inherit; font-size: 16px; }
.grp-opt-share-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 2px rgba(192,106,8,0.12); }

.change-calc { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; }
.change-calc label { font-size: 12px; color: var(--gray-500); font-weight: 700; }
.change-calc input { width: 100px !important; text-align: right; }
.change-ok { color: var(--success); font-weight: 700; }
.change-ng { color: var(--danger); font-weight: 700; }

/* --- お釣り早見 --- */
.change-calc-wrap { margin-top: 8px; padding: 10px 12px; background: linear-gradient(135deg, #fefbe8, #fef9e7); border: 1px solid rgba(234,179,8,0.15); border-radius: var(--radius-lg); }
.change-calc-label { font-size: 12px; font-weight: 700; color: var(--gray-600); margin-bottom: 8px; }
.change-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.change-chip { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 12px; border: 1.5px solid var(--border-strong); border-radius: var(--radius); background: var(--card); cursor: pointer; transition: all 0.15s; min-width: 80px; }
.change-chip:hover { border-color: var(--primary); background: var(--primary-light); transform: translateY(-1px); box-shadow: var(--shadow); }
.change-chip:active { transform: scale(0.97); }
.change-chip-selected { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 2px rgba(192,106,8,0.15); }
.change-chip-exact { border-color: var(--success); }
.change-chip-exact:hover { border-color: var(--success); background: var(--success-light); }
.change-chip-selected.change-chip-exact { background: var(--success-light); box-shadow: 0 0 0 2px rgba(22,163,74,0.15); }
.change-chip-amount { font-size: 14px; font-weight: 700; color: var(--gray-800); }
.change-chip-result { font-size: 10px; color: var(--success); font-weight: 600; }
.change-chip-exact .change-chip-result { color: var(--success); }
.change-custom { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.change-custom input { width: 100px !important; text-align: right; font-size: 13px; }
.change-amount { font-weight: 700; font-size: 13px; white-space: nowrap; }

.close-grid { display: flex; gap: 12px; flex-wrap: wrap; }
.close-stat { background: var(--primary-light); border-radius: var(--radius); padding: 16px 20px; text-align: center; min-width: 80px; flex: 1; border: 1px solid rgba(192,106,8,0.08); }
.close-num { display: block; font-size: 22px; font-weight: 700; color: var(--primary-dark); }
.success-box { background: var(--success-light); color: #065f46; padding: 10px 14px; border-radius: var(--radius); font-size: 14px; font-weight: 700; margin-bottom: 12px; border-left: 3px solid var(--success); }

.report-field { margin-bottom: 12px; }
.report-field label { display: block; font-size: 12px; font-weight: 700; color: var(--gray-500); margin-bottom: 4px; }

/* 日報サマリー */
.report-summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.report-summary-item { text-align: center; background: var(--gray-50); border-radius: var(--radius); padding: 8px 4px; }
.report-summary-num { display: block; font-size: 18px; font-weight: 700; color: var(--primary-dark); line-height: 1.2; }
.report-summary-item > span:last-child { font-size: 10px; color: var(--gray-400); }
.report-shop-chips { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }

/* ガイド別チーム（日報版） */
.report-team-block { margin-bottom: 8px; padding: 8px 10px; background: var(--primary-light); border-radius: var(--radius); border-left: 3px solid var(--primary); }
.report-team-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.report-team-header strong { font-size: 14px; color: var(--primary-dark); }
.report-team-meta { font-size: 11px; color: var(--gray-400); background: var(--gray-100); padding: 1px 6px; border-radius: 8px; }
.report-team-support { font-size: 11px; color: var(--gray-500); }
.report-team-list { display: flex; flex-wrap: wrap; gap: 4px; }
.report-team-item { font-size: 12px; color: var(--gray-700); background: var(--card); padding: 3px 8px; border-radius: 6px; border: 1px solid var(--border); white-space: nowrap; }

/* ==========================================
   海況ダッシュボード
   ========================================== */
.chart-container { min-height: 200px; }
.chart-container canvas { width: 100%; height: auto; border-radius: var(--radius); }
.weather-grid { display: flex; gap: 12px; flex-wrap: wrap; }
.weather-card { background: var(--gray-50); border-radius: var(--radius); padding: 16px 20px; text-align: center; min-width: 100px; flex: 1; border: 1px solid var(--border); }
.weather-card.weather-warning { background: var(--warning-light); border: 1px solid var(--warning); }
.weather-value { font-size: 22px; font-weight: 700; color: var(--gray-800); }
.weather-label { font-size: 11px; color: var(--gray-400); margin-top: 4px; }
.weather-alert { width: 100%; background: var(--warning-light); color: #7c5a10; padding: 8px 12px; border-radius: var(--radius); font-size: 13px; font-weight: 700; margin-top: 8px; border-left: 3px solid var(--warning); }
.tide-info { display: flex; gap: 12px; margin-bottom: 8px; }
.tide-type { font-size: 16px; font-weight: 700; color: var(--primary-dark); }
.lunar-day { font-size: 13px; color: var(--gray-400); }
.tide-times { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.tide-high { color: var(--danger); font-size: 13px; font-weight: 700; }
.tide-low { color: var(--accent); font-size: 13px; font-weight: 700; }
.sea-notes { background: var(--gray-50); border-radius: var(--radius); padding: 10px; margin-top: 8px; }
.sea-notes p { font-size: 12px; margin-bottom: 4px; }
.loading { color: var(--gray-400); font-size: 13px; }
.error { color: var(--danger); font-size: 13px; }

.slots-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.slot-card { background: var(--card); border-radius: var(--radius-lg); padding: 12px; text-align: center; box-shadow: var(--shadow); border: 2px solid transparent; }
.slot-card.slot-ok { border-color: var(--success); }
.slot-card.slot-few { border-color: var(--warning); }
.slot-card.slot-full { border-color: var(--danger); background: var(--danger-light); }
.slot-card.slot-closed { opacity: 0.5; }
.slot-time { font-size: 16px; font-weight: 700; color: var(--gray-800); }
.slot-bar { height: 6px; background: var(--gray-200); border-radius: 3px; margin: 6px 0; overflow: hidden; }
.slot-bar-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width .3s; }
.slot-full .slot-bar-fill { background: var(--danger); }
.slot-few .slot-bar-fill { background: var(--warning); }
.slot-numbers { font-size: 12px; color: var(--gray-500); }
.slot-remaining { font-size: 14px; font-weight: 700; color: var(--primary-dark); }
.slot-closed-label { font-size: 10px; color: var(--danger); font-weight: 700; margin-top: 2px; }
.slot-pickup-info { font-size: 14px; color: var(--gray-700); }

.settings-input { padding: 6px 8px !important; font-size: 13px !important; }
.settings-price { width: 100px !important; text-align: right; }
.settings-num { width: 60px !important; text-align: center; }
.settings-field { margin-bottom: 12px; }
.settings-field label { display: block; font-size: 12px; font-weight: 700; color: var(--gray-500); margin-bottom: 4px; }
.btn-icon-sm { background: none; border: none; cursor: pointer; font-size: 16px; padding: 4px; }
.btn-icon-sm:hover { opacity: 0.7; }
.template-edit-section { margin-bottom: 16px; }
.template-edit-section h4 { font-size: 13px; color: var(--gray-700); margin-bottom: 4px; }
.template-textarea { width: 100%; font-size: 12px; line-height: 1.6; font-family: var(--font); }

/* ==========================================
   ダッシュボード（ホーム）
   ========================================== */
.dash-date-header { text-align: center; padding: 16px 0 8px; }
.dash-date { font-size: 22px; font-weight: 700; color: var(--gray-800); letter-spacing: -0.02em; }
.dash-dow { display: inline-block; margin-left: 8px; font-size: 16px; font-weight: 700; color: var(--primary); }

.dash-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.dash-stat-card { background: var(--card); border-radius: var(--radius-lg); padding: 14px 8px; text-align: center; box-shadow: var(--shadow); border: 1px solid var(--border); }
.dash-stat-num { display: block; font-size: 22px; font-weight: 700; color: var(--gray-800); line-height: 1.2; }
.dash-stat-label { display: block; font-size: 10px; font-weight: 600; color: var(--gray-400); margin-top: 2px; }
.dash-stat-revenue { background: linear-gradient(135deg, #fff8f0, #fff5ea); border: 1px solid rgba(192,106,8,0.08); position: relative; overflow: hidden; }
.dash-stat-revenue::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, var(--primary), var(--primary-hover)); }
.dash-stat-revenue .dash-stat-num { color: var(--primary-dark); }

.dash-shop-breakdown { display: flex; gap: 6px; justify-content: center; margin-bottom: 12px; flex-wrap: wrap; }
.dash-shop-chip { font-size: 11px; font-weight: 600; padding: 3px 8px; border: 1.5px solid; border-radius: 12px; background: var(--card); }

.dash-notices { padding: 12px 14px; }
.dash-notices h3 { font-size: 14px; margin-bottom: 8px; }
.dash-notice { display: flex; align-items: flex-start; gap: 8px; padding: 9px 12px; border-radius: var(--radius); margin-bottom: 6px; background: var(--gray-50); border-left: 3px solid var(--gray-300); }
.dash-notice-equipment { border-left-color: var(--accent); background: var(--accent-light); }
.dash-notice-medical { border-left-color: var(--warning); background: var(--warning-light); }
.dash-notice-pickup { border-left-color: #8b5cf6; background: #faf5ff; }
.dash-notice-unpaid { border-left-color: var(--danger); background: var(--danger-light); }
.dash-notice-stale { border-left-color: var(--gray-500); background: var(--gray-50); }
.dash-notice-reminder_unsent { border-left-color: #dc2626; background: #fef2f2; animation: pulse-remind 2s ease-in-out infinite; }
@keyframes pulse-remind {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0); }
  50% { box-shadow: 0 0 0 4px rgba(220,38,38,0.15); }
}
.dash-notice-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.dash-notice-body { flex: 1; min-width: 0; }
.dash-notice-text { font-size: 13px; font-weight: 700; color: var(--gray-700); }
.dash-notice-detail { font-size: 11px; color: var(--gray-400); margin-top: 2px; }
.dash-notice-empty { text-align: center; padding: 12px; color: var(--success); font-size: 14px; font-weight: 700; }

.dash-sea-snap { padding: 12px 14px; }
.dash-sea-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.dash-sea-header h3 { font-size: 14px; margin-bottom: 0; }
.dash-sea-toggle { display: flex; gap: 2px; background: var(--gray-100); border-radius: 8px; padding: 2px; }
.dash-sea-btn { padding: 4px 12px; border: none; border-radius: 6px; font-size: 11px; font-weight: 700; cursor: pointer; background: transparent; color: var(--gray-400); transition: all 0.15s; font-family: var(--font); }
.dash-sea-btn-active { background: var(--card); color: var(--primary); box-shadow: var(--shadow); }
.dash-sea-grid { display: flex; gap: 6px; flex-wrap: wrap; }
.dash-sea-item { flex: 1; min-width: 60px; text-align: center; background: linear-gradient(180deg, #fef6ee, #fefaf5); border-radius: var(--radius); padding: 10px 6px; border: 1px solid rgba(192,106,8,0.06); }
.dash-sea-item.dash-sea-warn { background: var(--warning-light); border: 1px solid var(--warning); }
.dash-sea-val { display: block; font-size: 18px; font-weight: 700; color: var(--gray-800); line-height: 1.2; }
.dash-sea-icon { display: block; font-size: 36px; line-height: 1.1; }
.dash-sea-max { font-size: 13px; font-weight: 600; color: var(--gray-400); }
.dash-sea-lbl { display: block; font-size: 10px; color: var(--gray-400); margin-top: 2px; }
.dash-sea-sub { display: block; font-size: 9px; color: var(--gray-300); margin-top: 1px; }

.dash-bars { display: flex; gap: 6px; align-items: flex-end; height: 160px; padding: 8px 0; }
.dash-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.dash-bar-today .dash-bar-fill { background: linear-gradient(180deg, var(--primary-hover), var(--primary)) !important; }
.dash-bar-today .dash-bar-label { color: var(--primary); font-weight: 700; }
.dash-bar-nums { font-size: 12px; font-weight: 600; color: var(--gray-700); margin-bottom: 4px; }
.dash-bar-nums small { font-size: 9px; color: var(--gray-400); }
.dash-bar-track { flex: 1; width: 100%; max-width: 28px; background: var(--gray-100); border-radius: 6px; display: flex; align-items: flex-end; overflow: hidden; }
.dash-bar-fill { width: 100%; background: linear-gradient(180deg, var(--gray-300), var(--gray-400)); border-radius: 6px; transition: height 0.3s ease; min-height: 2px; }
.dash-bar-label { font-size: 12px; font-weight: 500; color: var(--gray-500); margin-top: 4px; }
.dash-bar-date { font-size: 9px; color: var(--gray-400); }

.dash-upcoming-group { margin-bottom: 12px; }
.dash-upcoming-label { font-size: 12px; font-weight: 700; color: var(--primary-dark); padding: 4px 0; border-bottom: 2px solid var(--primary); margin-bottom: 6px; }
.dash-upcoming-item { display: flex; align-items: center; gap: 6px; padding: 9px 8px; border-bottom: 1px solid var(--gray-100); cursor: pointer; border-radius: var(--radius); transition: background 0.1s; }
.dash-upcoming-item:hover { background: var(--gray-50); }
.dash-upcoming-time { font-size: 13px; font-weight: 700; color: var(--gray-600); min-width: 48px; }
.dash-upcoming-name { font-size: 14px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-upcoming-people { font-size: 12px; color: var(--gray-500); }
.dash-upcoming-course { font-size: 11px; color: var(--gray-400); display: none; }
.dash-tag-sm { font-size: 12px; }
.dash-upcoming-empty { text-align: center; padding: 12px; color: var(--gray-400); font-size: 13px; }

.dash-month-stats { display: flex; gap: 12px; }
.dash-month-item { flex: 1; text-align: center; background: var(--gray-50); border-radius: var(--radius); padding: 14px 8px; border: 1px solid var(--border); }
.dash-month-num { display: block; font-size: 20px; font-weight: 700; color: var(--primary-dark); }
.dash-month-label { display: block; font-size: 11px; color: var(--gray-400); margin-top: 2px; }

.dash-slots { display: flex; flex-direction: column; gap: 6px; }
.dash-slot { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.dash-slot-time { font-size: 13px; font-weight: 700; color: var(--gray-700); min-width: 48px; }
.dash-slot-bar { flex: 1; height: 8px; background: var(--gray-100); border-radius: 4px; overflow: hidden; }
.dash-slot-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.3s; }
.dash-slot-full .dash-slot-fill { background: var(--danger); }
.dash-slot-few .dash-slot-fill { background: var(--warning); }
.dash-slot-nums { font-size: 12px; color: var(--gray-500); min-width: 40px; text-align: right; }
.dash-slot-remain { font-size: 12px; font-weight: 700; min-width: 36px; }
.dash-slot-ok .dash-slot-remain { color: var(--success); }
.dash-slot-few .dash-slot-remain { color: var(--warning); }
.dash-slot-full .dash-slot-remain { color: var(--danger); }

@media (max-width: 480px) {
  .dash-stats { grid-template-columns: repeat(2, 1fr); }
  .dash-stat-num { font-size: 18px; }
  .dash-sea-item { min-width: 55px; }
  .dash-sea-val { font-size: 15px; }
  .dash-sea-icon { font-size: 30px; }
  .dash-upcoming-course { display: none; }
}
@media (min-width: 481px) {
  .dash-upcoming-course { display: inline; }
}

/* ==========================================
   予約検索・月一覧
   ========================================== */
.search-bar { position: relative; margin-bottom: 10px; }
.search-bar input { width: 100%; padding: 10px 14px; padding-right: 36px; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); font-size: 14px; background: var(--card); box-shadow: var(--shadow); }
.search-bar input:focus { border-color: var(--primary); outline: none; }
.search-clear { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: var(--gray-200); border: none; border-radius: 50%; width: 22px; height: 22px; font-size: 12px; cursor: pointer; color: var(--gray-500); display: flex; align-items: center; justify-content: center; }
.search-result-count { font-size: 13px; color: var(--gray-500); margin-bottom: 8px; font-weight: 700; }

.month-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; background: var(--card); padding: 8px 12px; border-radius: var(--radius-lg); box-shadow: var(--shadow); border: 1px solid var(--border); }
.month-label { font-size: 16px; font-weight: 700; color: var(--gray-800); min-width: 100px; text-align: center; }
.status-filter-select { margin-left: auto; padding: 4px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius); font-size: 12px; background: var(--card); }

.monthly-summary { display: flex; gap: 16px; padding: 8px 12px; background: var(--primary-light); border-radius: var(--radius); margin-bottom: 8px; font-size: 14px; font-weight: 700; color: var(--primary-dark); border: 1px solid rgba(192,106,8,0.08); }

.monthly-table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow); border: 1px solid var(--border); }
.monthly-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.monthly-table th { background: var(--gray-100); padding: 8px 10px; font-size: 10px; color: var(--gray-500); text-align: left; position: sticky; top: 0; white-space: nowrap; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.monthly-table td { padding: 8px 10px; border-bottom: 1px solid var(--gray-100); white-space: nowrap; }
.monthly-row { cursor: pointer; transition: background 0.1s; }
.monthly-row:hover { background: var(--gray-50); }
.monthly-name { font-weight: 600; }
.monthly-course { color: var(--gray-500); font-size: 12px; }
.monthly-price { font-weight: 700; color: var(--primary-dark); }

@media (max-width: 480px) {
  .monthly-table { font-size: 12px; }
  .monthly-table th, .monthly-table td { padding: 6px 6px; }
  .monthly-price { display: none; }
  .header-actions { gap: 2px; }
  .header-actions .btn { padding: 4px 8px; font-size: 11px; }
}

/* ==========================================
   詳細モーダル編集UI
   ========================================== */
.edit-cell { border: 1px solid var(--border-strong); border-radius: 6px; padding: 3px 5px; font-size: 13px; background: var(--card); width: 100%; box-sizing: border-box; font-family: var(--font); }
.edit-cell:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(192,106,8,0.08); }
.edit-cell-num { width: 60px; text-align: right; }
.edit-cell-gender { width: 48px; text-align: center; padding: 3px 2px !important; }
.edit-input { border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 6px 10px; font-size: 14px; background: var(--card); width: 100%; box-sizing: border-box; font-family: var(--font); }
.edit-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(192,106,8,0.08); }
.detail-grid-edit { gap: 10px; }
.detail-grid-edit .detail-item { display: flex; flex-direction: column; gap: 4px; }

.btn-outline { background: transparent; border: 1px solid var(--border-strong); color: var(--gray-700); border-radius: var(--radius-pill); font-family: var(--font); }
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); }

.vehicle-assign-wrap { padding: 4px 0; }
.vehicle-assign-label { font-size: 14px; font-weight: 700; color: var(--gray-700); margin-bottom: 8px; }
.vehicle-radio-group { display: flex; flex-wrap: wrap; gap: 8px; }
.vehicle-radio-card { display: flex; align-items: center; gap: 6px; border: 2px solid var(--border-strong); border-radius: var(--radius-lg); padding: 10px 14px; cursor: pointer; transition: border-color 0.15s, background 0.15s; background: var(--card); }
.vehicle-radio-card:hover { border-color: var(--gray-400); }
.vehicle-radio-card.selected { border-color: var(--primary); background: var(--primary-light); }
.vehicle-radio-card input[type="radio"] { accent-color: var(--primary); }
.vehicle-radio-inner { display: flex; flex-direction: column; gap: 2px; }
#participants-edit-table td:nth-child(2) input { min-width: 70px; }
#participants-edit-table td:nth-child(3) input { width: 48px; }
.edit-cell-name { min-width: 110px !important; width: 110px; }
.vehicle-cap { font-size: 12px; color: var(--gray-500); background: var(--gray-100); padding: 2px 8px; border-radius: 10px; }

.checkbox-label { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; cursor: pointer; padding: 3px 6px; border-radius: 8px; transition: background 0.1s; }
.checkbox-label:hover { background: var(--gray-50); }
.checkbox-label input[type="checkbox"] { accent-color: var(--primary); }

.team-block { border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: 12px; margin-bottom: 10px; background: var(--card); }
.team-block-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.team-block-header strong { font-size: 14px; color: var(--primary-dark); }
.team-members { margin-top: 8px; }
.team-members > label { display: block; font-size: 13px; font-weight: 700; color: var(--gray-600); margin-bottom: 4px; }
.member-checkboxes { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.team-vehicle-row { display: flex; gap: 10px; margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); }
.team-vehicle-row .detail-row { flex: 1; }
@media (max-width: 480px) { .team-vehicle-row { flex-direction: column; gap: 6px; } }
.pickup-team-label { display: inline-block; font-size: 10px; font-weight: 700; background: var(--primary-light, #fff3e6); color: var(--primary, #c06a08); padding: 1px 6px; border-radius: 8px; margin-left: 4px; }

/* --- ガイド別チームグループ（段取りタブ） --- */
.team-group-block { margin-bottom: 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow-x: auto; overflow-y: visible; background: var(--card); box-shadow: var(--shadow); }
.team-group-block + .team-group-block { margin-top: 12px; }
.team-group-header { padding: 10px 14px; background: linear-gradient(135deg, var(--primary-light), #fff8f0); border-bottom: 2px solid var(--primary); }
.team-group-guide { display: flex; align-items: center; gap: 8px; }
.team-group-icon { font-size: 20px; }
.team-group-name { font-size: 18px; font-weight: 800; color: var(--primary-dark); }
.team-group-count { font-size: 12px; color: var(--gray-500); font-weight: 600; background: var(--gray-100); padding: 2px 8px; border-radius: 10px; }
.team-group-support { font-size: 11px; color: var(--gray-400); margin-top: 2px; font-weight: 500; }
.team-group-block .invoice-table { margin: 0; min-width: 800px; }
.team-group-block .invoice-table th { font-size: 10px; }

/* --- 段取りタブ 概要+海況 横2カラム --- */
.op-top-row { display: flex; gap: 10px; margin-bottom: 10px; }
.op-top-left, .op-top-right { flex: 1; background: var(--card); border-radius: var(--radius-lg); padding: 12px 14px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.op-top-left h3, .op-top-right h3 { font-size: 12px; margin-bottom: 6px; color: var(--gray-500); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }

/* 概要: 日付 + 統計グリッド */
.op-date-display { font-size: 15px; font-weight: 700; color: var(--gray-800); margin-bottom: 8px; }
.op-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.op-stat-item { display: flex; align-items: baseline; gap: 4px; padding: 6px 10px; background: var(--primary-light); border-radius: var(--radius); border: 1px solid rgba(192,106,8,0.06); }
.op-stat-num { font-size: 20px; font-weight: 800; color: var(--primary-dark); line-height: 1; }
.op-stat-desc { font-size: 11px; color: var(--gray-500); font-weight: 600; }

@media (max-width: 640px) {
  .op-top-row { flex-direction: column; }
  .op-stats-grid { grid-template-columns: repeat(4, 1fr); }
  .op-stat-item { flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 8px 4px; }
}

/* --- 段取りタブ 海況カード --- */
.op-sea-cards { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }

/* 段取りPDF共有バー */
.op-share-bar { display: flex; justify-content: flex-end; margin-bottom: 8px; }

/* 段取り日付ナビ */
.op-date-nav { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; background: var(--card); padding: 8px 12px; border-radius: var(--radius-lg); box-shadow: var(--shadow); border: 1px solid var(--border); }

/* 段取り印刷用ヘッダー（画面非表示） */
.op-print-header { display: none; }
.op-print-header-top { display: flex; justify-content: space-between; align-items: baseline; }
.op-print-header-top h1 { font-size: 22px; font-weight: 800; }
.op-print-header-sub { display: flex; justify-content: space-between; margin-top: 4px; font-size: 14px; font-weight: 600; }
.op-sea-card { flex: 1; min-width: 70px; text-align: center; background: linear-gradient(180deg, var(--gray-50), var(--card)); border-radius: var(--radius); padding: 10px 6px; border: 1px solid var(--border); }
.op-sea-card.op-sea-warn { background: var(--warning-light); border-color: var(--warning); }
.op-sea-icon { display: block; font-size: 20px; margin-bottom: 2px; }
.op-sea-val { display: block; font-size: 17px; font-weight: 700; color: var(--gray-800); line-height: 1.2; }
.op-sea-sub { display: block; font-size: 12px; color: var(--gray-500); font-weight: 600; }
.op-sea-lbl { display: block; font-size: 10px; color: var(--gray-400); margin-top: 3px; }
.op-tide-times { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; padding: 6px 0; }

/* 参加者カードレイアウト（詳細モーダル） */
.pcard {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  background: var(--gray-50);
  overflow: hidden;
}
.pcard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 10px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.pcard-num { font-size: 13px; }
.pcard-header .btn-icon { color: #fff; opacity: 0.7; font-size: 14px; }
.pcard-header .btn-icon:hover { opacity: 1; }
/* ★ v28: 確認画面の参加者削除ボタン — 目立つデザイン */
.pcard-header .btn-del-participant {
  background: rgba(255,255,255,0.9);
  color: var(--danger);
  border: none;
  border-radius: 4px;
  font-size: 15px;
  padding: 2px 6px;
  cursor: pointer;
  opacity: 1;
  line-height: 1;
}
.pcard-header .btn-del-participant:hover {
  background: var(--danger);
  color: #fff;
}
.pcard-body-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
}
.pcard-field { display: flex; flex-direction: column; gap: 2px; }
.pcard-field label { font-size: 10px; color: var(--gray-400); font-weight: 600; letter-spacing: 0.03em; }
.pcard-field .edit-cell { font-size: 13px; padding: 4px 6px; }
.pcard-field-name { flex: 1 1 140px; min-width: 120px; }
.pcard-field-age { flex: 0 0 58px; }
.pcard-field-gender { flex: 0 0 52px; }
.pcard-field-num { flex: 0 0 68px; }
.pcard-field-vision { flex: 0 0 60px; }
.pcard-field-age .edit-cell,
.pcard-field-num .edit-cell { text-align: right; }
.pcard-eq-row {
  display: flex;
  gap: 10px;
  padding: 5px 10px;
  background: var(--card);
  border-top: 1px solid var(--border);
  font-size: 12px;
  flex-wrap: wrap;
}
.pcard-eq-item { white-space: nowrap; color: var(--primary-dark); }
.pcard-eq-item b { font-size: 10px; color: var(--gray-400); margin-right: 2px; }
.pcard-eq-item small { color: var(--gray-400); font-size: 10px; }

/* 複数予約バナー */
.multi-booking-banner {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
}
.multi-booking-dots { display: flex; gap: 6px; }
.mbd {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  background: rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.6);
}
.mbd.done { background: rgba(255,255,255,0.5); color: #fff; }
.mbd.active { background: #fff; color: var(--primary-dark); box-shadow: 0 0 0 2px rgba(255,255,255,0.4); }

/* ── まとめる/別々モーダル ── */
.merge-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.merge-modal {
  background: var(--bg-card, #fff);
  border-radius: 16px;
  padding: 24px 20px 20px;
  max-width: 420px; width: 100%;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
  text-align: center;
}
.merge-modal h3 {
  margin: 0 0 16px;
  font-size: 17px;
  color: var(--primary-dark, #5a3a1a);
}
.merge-groups-list {
  text-align: left;
  margin-bottom: 12px;
  max-height: 200px;
  overflow-y: auto;
}
.merge-group-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-surface, #f8f4ef);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}
.merge-group-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--primary, #c06a08);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.merge-group-detail { flex: 1; line-height: 1.4; }
.merge-group-course {
  display: inline-block;
  font-size: 11px;
  color: var(--text-muted, #888);
  margin-left: 4px;
}
.merge-group-date {
  display: inline-block;
  font-size: 11px;
  color: var(--text-muted, #888);
  margin-left: 4px;
}
.merge-inherited-tag {
  display: block;
  font-size: 10px;
  color: var(--primary, #c06a08);
  font-weight: 600;
  margin-top: 2px;
}
.merge-total {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary, #c06a08);
  margin: 4px 0 16px;
}
.merge-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.merge-btn-combine,
.merge-btn-separate {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.15s;
}
.merge-btn-combine {
  background: linear-gradient(135deg, var(--primary-dark, #5a3a1a), var(--primary, #c06a08));
  color: #fff;
  border-color: var(--primary, #c06a08);
}
.merge-btn-combine:hover { filter: brightness(1.1); }
.merge-btn-separate {
  background: var(--bg-surface, #f8f4ef);
  color: var(--text-dark, #3d2b1f);
  border-color: var(--border, #d4c4b0);
}
.merge-btn-separate:hover { border-color: var(--primary, #c06a08); }
.merge-btn-icon { font-size: 22px; flex-shrink: 0; }
.merge-btn-text { display: flex; flex-direction: column; gap: 2px; }
.merge-btn-text small {
  font-size: 11px;
  font-weight: 400;
  opacity: 0.75;
}
.merge-cancel {
  background: none; border: none;
  color: var(--text-muted, #888);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 12px;
}
.merge-cancel:hover { color: var(--text-dark, #3d2b1f); }

/* pcard mobile: handled in main @media (max-width: 640px) block */

/* ==========================================
   キャンペーン設定
   ========================================== */

.campaign-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 12px;
  background: var(--card);
  transition: border-color 0.2s;
}
.campaign-card.camp-active { border-left: 4px solid var(--success); }
.campaign-card.camp-upcoming { border-left: 4px solid var(--warning); }
.campaign-card.camp-past { border-left: 4px solid var(--gray-400); opacity: 0.7; }
.campaign-card.camp-inactive { border-left: 4px solid var(--gray-300); opacity: 0.6; }

.campaign-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.campaign-status {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.campaign-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-dark);
  flex: 1;
}
.campaign-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.campaign-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.campaign-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.campaign-field label {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* 割引行（料金表示内） */
.price-row.price-discount span {
  color: var(--danger, #dc2626);
  font-weight: 700;
}
.price-row.price-discount span:first-child {
  color: var(--warning, #d97706);
}

/* campaign-row mobile: handled in main @media (max-width: 640px) block */

/* ==========================================
   器材準備 — ステータス＆メモ
   ========================================== */

.equip-table th:nth-child(11),
.equip-table th:nth-child(12) {
  white-space: nowrap;
}

.btn-equip-status {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 16px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  padding: 0;
  line-height: 32px;
  text-align: center;
  transition: transform 0.15s, background 0.15s;
}
.btn-equip-status:hover { transform: scale(1.15); }
.btn-equip-status:active { transform: scale(0.95); }

.equip-memo-input {
  width: 100%;
  min-width: 100px;
  max-width: 180px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 11px;
  background: var(--card);
  color: var(--text);
  transition: border-color 0.3s;
}
.equip-memo-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* 行背景色 — ステータス別 */
tr.equip-row-done {
  background: rgba(34, 197, 94, 0.08);
}
tr.equip-row-partial {
  background: rgba(234, 179, 8, 0.08);
}
tr.equip-row-none {
  background: transparent;
}

/* 進捗サマリー */
.equip-progress {
  font-size: 12px;
  font-weight: 600;
  margin-left: 12px;
  letter-spacing: 1px;
}

/* 段取りタブ — インラインセレクト */
.inline-select {
  width: 90px;
  padding: 3px 6px;
  font-size: 11px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: transparent;
  font-family: inherit;
}

/* ==========================================
   モバイル最適化
   ========================================== */

/* --- 帳票テーブル全般: 横スクロール対応 --- */
.invoice-section {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* --- モーダル開いた時のbodyスクロール防止 --- */
body.modal-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  touch-action: none;
}

@media (max-width: 640px) {

  /* ===== グローバル最適化 ===== */

  /* iOS input zoom 防止 */
  input[type="text"],
  input[type="tel"],
  input[type="number"],
  input[type="date"],
  input[type="time"],
  input[type="url"],
  select,
  textarea {
    font-size: 16px !important;
  }

  /* タッチターゲット最小サイズ (44px Apple HIG) */
  .btn { min-height: 44px; padding: 10px 16px; }
  .btn-small { min-height: 38px; padding: 8px 14px; font-size: 12px; }
  .btn-icon { min-height: 44px; min-width: 44px; font-size: 20px; }

  /* ===== ヘッダー ===== */
  .app-header { padding: 0 10px; }
  .app-title { font-size: 16px; }
  .shop-select { font-size: 14px; padding: 4px 8px; max-width: 140px; }

  /* ===== ナビゲーション ===== */
  .nav-item { padding: 6px 2px; }
  .nav-icon { font-size: 18px; }
  .nav-label { font-size: 9px; letter-spacing: -0.02em; }

  /* ===== メインコンテンツ ===== */
  .main-content { padding: 10px; }
  .card { padding: 12px; margin-bottom: 8px; }

  /* ===== ページヘッダー ===== */
  .page-header { flex-wrap: wrap; gap: 8px; }
  .page-header h2 { font-size: 16px; flex: 1; }
  .header-actions { flex-wrap: wrap; gap: 4px; }
  .header-actions .btn-small { padding: 6px 10px; font-size: 11px; min-height: 34px; }

  /* ===== 日付ナビ ===== */
  .date-nav { flex-wrap: wrap; gap: 6px; padding: 8px 10px; }
  .date-nav input[type="date"] { flex: 1; min-width: 120px; }

  /* ===== 予約一覧 ===== */
  /* 月ナビ */
  .month-nav { flex-wrap: wrap; gap: 6px; }
  .month-label { min-width: auto; font-size: 15px; }
  .status-filter-select { margin-left: 0; flex: 1; min-width: 80px; }

  /* 予約カード */
  .booking-card { padding: 10px 12px; }
  .card-header { flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
  .rep-name { font-size: 14px; }
  .card-body { gap: 6px; }
  .card-sub { flex-wrap: wrap; }
  .card-price { font-size: 13px; white-space: nowrap; }

  /* 月一覧テーブル */
  .monthly-table { font-size: 12px; }
  .monthly-table th, .monthly-table td { padding: 6px 6px; }
  .monthly-price { display: none; }

  /* ===== 検索バー ===== */
  .search-bar input { padding: 12px 14px; padding-right: 40px; }

  /* ===== 新規予約 ===== */
  #line-input { font-size: 16px !important; line-height: 1.5; min-height: 200px; }
  .confirm-row { flex-direction: column; align-items: stretch; gap: 4px; }
  .confirm-row label { min-width: auto; font-size: 11px; }
  .confirm-row input,
  .confirm-row select { max-width: 100%; }

  /* ===== 参加者カード ===== */
  .pcard-body-row { gap: 4px; padding: 6px 8px; }
  .pcard-field-name { flex: 1 1 100%; min-width: 0; }
  .pcard-field-age { flex: 1 1 calc(33% - 4px); min-width: 60px; }
  .pcard-field-gender { flex: 1 1 calc(33% - 4px); min-width: 52px; }
  .pcard-field-num { flex: 1 1 calc(33% - 4px); min-width: 60px; }
  .pcard-field-vision { flex: 1 1 calc(33% - 4px); min-width: 55px; }
  .pcard-field .edit-cell { font-size: 14px !important; padding: 6px 6px; }
  .pcard-eq-row { font-size: 11px; gap: 6px; padding: 4px 8px; flex-wrap: wrap; }
  .p-input { padding: 6px 4px !important; font-size: 14px !important; }

  /* ===== 詳細モーダル ===== */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-content {
    max-height: calc(95vh - env(safe-area-inset-top, 0px));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    margin-top: env(safe-area-inset-top, 0px);
  }
  .modal-large { max-width: 100%; margin: 0; margin-top: env(safe-area-inset-top, 0px); }
  .modal-header { padding: 14px 14px; position: sticky; top: 0; background: var(--card); z-index: 10; border-bottom: 1px solid var(--border); min-height: 48px; }
  .modal-header h3 { font-size: 16px; }
  .btn-close { min-width: 44px; min-height: 44px; font-size: 20px; display: flex; align-items: center; justify-content: center; }
  .modal-body { padding: 12px 14px; }

  /* 詳細グリッド → 1カラム */
  .detail-grid { grid-template-columns: 1fr; gap: 6px; }
  .detail-grid-edit { grid-template-columns: 1fr 1fr; }
  .detail-item { font-size: 13px; }
  .detail-label { font-size: 11px; }
  .detail-row { flex-direction: column; gap: 4px; align-items: stretch; margin-bottom: 8px; }
  .detail-row label { min-width: auto; font-size: 12px; }
  .detail-row select,
  .detail-row input { flex: 1; max-width: 100%; }

  /* チームブロック */
  .team-block { margin-bottom: 12px; padding: 10px; background: var(--gray-50); border-radius: var(--radius); }
  .team-block-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
  .team-vehicle-row { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
  .team-members { margin-top: 6px; }
  .member-checkboxes { display: flex; flex-wrap: wrap; gap: 2px; }
  .checkbox-label { display: flex; align-items: center; gap: 4px; padding: 6px 8px; font-size: 13px; min-height: 38px; background: var(--card); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
  .checkbox-label input[type="checkbox"] { width: 18px; height: 18px; }

  /* テンプレートボタン */
  .template-buttons { gap: 4px; }
  .template-buttons .btn { padding: 8px 10px; font-size: 11px; min-height: 36px; }
  .template-output { font-size: 14px !important; }

  /* アクション */
  .detail-actions { position: sticky; bottom: 0; background: var(--card); padding: 12px 0; border-top: 1px solid var(--border); margin: 0 -14px; padding: 12px 14px; display: flex; gap: 8px; }
  .detail-actions .btn { flex: 1; }

  /* 料金サマリー */
  .price-summary { padding: 10px; }
  .price-row { font-size: 12px; padding: 3px 0; }
  .price-total { font-size: 15px; }

  /* ===== 帳票タブ ===== */
  .tab-bar { gap: 2px; padding: 2px; }
  .tab-btn { padding: 8px 2px; font-size: 10px; min-height: 52px; }
  .tab-icon { font-size: 18px; margin-bottom: 2px; }

  /* ===== 器材テーブル ===== */
  .equip-table { font-size: 11px; }
  .equip-table th { padding: 5px 3px; font-size: 9px; letter-spacing: 0; white-space: nowrap; }
  .equip-table td { padding: 4px 3px; }
  .equip-table .brand-sub { display: none; }
  .equip-memo-input { min-width: 80px; max-width: 120px; font-size: 14px !important; }
  .btn-equip-status { min-width: 38px; min-height: 38px; font-size: 16px; }

  /* ===== 送迎テーブル ===== */
  #pickup-list-table { font-size: 11px; }
  #pickup-list-table th { padding: 5px 4px; font-size: 9px; white-space: nowrap; }
  #pickup-list-table td { padding: 5px 4px; }
  #pickup-list-table select { font-size: 14px !important; min-height: 38px; }
  #pickup-list-table input[type="time"] { font-size: 14px !important; min-height: 38px; width: 90px !important; }
  .pickup-summary { flex-wrap: wrap; font-size: 13px; gap: 8px; padding: 10px; }

  /* ===== 段取りタブ ===== */
  .inline-select { width: 80px; font-size: 14px !important; padding: 6px 4px; min-height: 36px; }
  #staff-assign-table { font-size: 11px; }
  #staff-assign-table th { padding: 5px 3px; font-size: 9px; }
  #staff-assign-table td { padding: 4px 3px; }
  .op-top-row { flex-direction: column; }
  .op-stats-grid { grid-template-columns: repeat(4, 1fr); }
  .op-stat-item { flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 8px 4px; }
  .op-sea-cards { gap: 4px; }
  .op-sea-card { min-width: 60px; padding: 8px 4px; }
  .op-sea-val { font-size: 15px; }
  .op-sea-icon { font-size: 16px; }

  /* ===== 精算 ===== */
  /* 精算一覧 */
  .billing-list-item { padding: 10px 10px; gap: 8px; min-height: 56px; }
  .billing-list-name { font-size: 14px; }
  .billing-list-price { font-size: 14px; }
  .billing-list-arrow { font-size: 16px; }

  /* 精算カード */
  .billing-card { margin-bottom: 8px; }
  .billing-header { padding: 10px 12px; }
  .billing-name { font-size: 14px; }
  .billing-meta { font-size: 11px; }
  .billing-body { padding: 10px 12px; }
  .billing-row { font-size: 12px; flex-wrap: wrap; }
  .billing-total-row { font-size: 15px; }
  .billing-local { padding: 10px; }
  .billing-local .local-due { font-size: 18px; }
  .prepaid-input { width: 100px !important; font-size: 16px !important; }
  .billing-prepaid-group { flex-wrap: wrap; gap: 6px; }
  .billing-prepaid-group select { min-width: 90px; font-size: 14px !important; min-height: 38px; }
  .billing-actions { flex-wrap: wrap; gap: 6px; }
  .billing-actions .btn { flex: 1; min-width: 120px; }

  /* お釣り早見 */
  .change-calc-wrap { padding: 8px 10px; }
  .change-chips { gap: 4px; }
  .change-chip { padding: 8px 10px; min-width: 72px; min-height: 52px; }
  .change-chip-amount { font-size: 13px; }
  .change-chip-result { font-size: 10px; }
  .change-custom input { width: 100px !important; font-size: 16px !important; }
  .change-custom { flex-wrap: wrap; gap: 6px; }

  /* ===== 設定 ===== */
  .settings-table { font-size: 13px; }
  .settings-table th { padding: 6px 6px; font-size: 10px; }
  .settings-table td { padding: 8px 6px; }
  .settings-input { padding: 8px 8px !important; font-size: 14px !important; }
  .settings-price { width: 80px !important; }
  .settings-num { width: 60px !important; }
  .settings-field label { font-size: 13px; }

  /* ===== 日次締め ===== */
  .close-grid { gap: 6px; }
  .close-stat { padding: 10px 8px; min-width: 65px; }
  .close-num { font-size: 18px; }

  /* ===== 日報 ===== */
  .invoice-table.compact th { padding: 4px 3px; font-size: 9px; }
  .invoice-table.compact td { padding: 3px 3px; font-size: 11px; }
  .report-summary-grid { grid-template-columns: repeat(2, 1fr); }

  /* ===== 海況 ===== */
  .weather-card { min-width: 80px; padding: 10px 8px; }
  .weather-value { font-size: 18px; }
  .tide-times { gap: 8px; }

  /* ===== キャンペーン設定 ===== */
  .campaign-card { padding: 10px; }
  .campaign-name { font-size: 13px; }
  .campaign-row { grid-template-columns: 1fr; }
  .campaign-field input,
  .campaign-field select { font-size: 14px !important; }

  /* ===== カレンダー ===== */
  .cal-cell { min-height: auto; padding: 4px 2px; }
  .cal-day { font-size: 12px; }
  .cal-count { font-size: 8px; }

  /* ===== ダッシュボード ===== */
  .dash-date { font-size: 18px; }
  .dash-dow { font-size: 14px; }
  .dash-notice { padding: 8px 10px; }
  .dash-notice-text { font-size: 12px; }
  .dash-notice-detail { font-size: 10px; }
  .dash-sea-grid { gap: 4px; }
  .dash-sea-item { min-width: 55px; padding: 8px 4px; }
  .dash-sea-val { font-size: 15px; }
  .dash-sea-icon { font-size: 28px; }
  .merge-modal-overlay { padding: 10px; }
  .merge-modal { padding: 20px 16px 16px; }
  .merge-modal h3 { font-size: 15px; }
  .merge-btn-combine,
  .merge-btn-separate { padding: 12px 14px; min-height: 56px; }

  /* ===== 複数予約バナー ===== */
  .multi-booking-banner { padding: 8px 10px; font-size: 12px; flex-wrap: wrap; gap: 6px; }

  /* ===== btn-group 全般 ===== */
  .btn-group { flex-wrap: wrap; gap: 6px; }
  .btn-group .btn { flex: 1; min-width: 120px; justify-content: center; }
}

/* ===== 480px: スマホ中間 ===== */
@media (max-width: 480px) {
  .dash-stats { grid-template-columns: repeat(2, 1fr); }
  .dash-stat-num { font-size: 18px; }
  .dash-bars { height: 130px; }

  /* 詳細グリッドも1カラム */
  .detail-grid-edit { grid-template-columns: 1fr; }

  /* 参加者カード: 全フィールド2列に */
  .pcard-field-age,
  .pcard-field-gender,
  .pcard-field-num,
  .pcard-field-vision { flex: 1 1 calc(50% - 4px); min-width: 0; }

  /* 送迎テーブル: 電話列非表示 */
  #pickup-list-table th:nth-child(7),
  #pickup-list-table td:nth-child(7) { display: none; }
}

/* ===== 380px: 超小型端末（iPhone SE等） ===== */
@media (max-width: 380px) {
  .main-content { padding: 6px; }
  .card { padding: 8px; }
  .card h3 { font-size: 11px; }
  .nav-label { font-size: 8px; }
  .nav-icon { font-size: 16px; }
  .bottom-nav { height: 52px; }
  :root { --nav-h: 52px; }
  .app-title { font-size: 14px; }
  .shop-select { padding: 3px 6px; max-width: 110px; }

  /* ダッシュボード */
  .dash-stat-card { padding: 8px 6px; }
  .dash-stat-num { font-size: 16px; }
  .dash-stat-label { font-size: 9px; }
  .dash-month-num { font-size: 17px; }
  .dash-month-stats { flex-direction: column; }

  /* タブバー */
  .tab-btn { padding: 6px 1px; font-size: 9px; }
  .tab-icon { font-size: 15px; }

  /* 器材テーブル: さらに縮小 */
  .equip-table { font-size: 10px; }
  .equip-table th { padding: 4px 2px; font-size: 8px; }
  .btn-equip-status { min-width: 32px; min-height: 32px; font-size: 14px; }
  .equip-memo-input { min-width: 60px; max-width: 90px; }

  /* 段取りセレクト */
  .inline-select { width: 70px; }

  /* 送迎テーブル: 地図列も非表示 */
  #pickup-list-table th:nth-child(6),
  #pickup-list-table td:nth-child(6) { display: none; }

  /* ページヘッダー */
  .page-header h2 { font-size: 14px; }
  .date-input-sm { width: 120px !important; }

  /* 精算一覧 */
  .billing-summary-count { font-size: 20px; }
  .billing-list-item { padding: 8px; }
}

/* ==========================================
   ★ LINE チャット UI（Phase1）
   ========================================== */

.line-msg {
  display: flex;
  margin-bottom: 6px;
}
.line-msg-receive {
  justify-content: flex-start;
}
.line-msg-send {
  justify-content: flex-end;
}
.line-msg-bubble {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}
.line-msg-receive .line-msg-bubble {
  background: #f5ede2;
  color: #3d2e1a;
  border-bottom-left-radius: 4px;
}
.line-msg-send .line-msg-bubble {
  background: linear-gradient(135deg, #c06a08, #d4a55a);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.line-msg-time {
  font-size: 10px;
  margin-top: 3px;
  opacity: 0.6;
}
.line-msg-receive .line-msg-time {
  text-align: left;
}
.line-msg-send .line-msg-time {
  text-align: right;
}
#line-history-container {
  padding: 8px;
  background: rgba(245, 237, 226, 0.3);
  border-radius: 10px;
  border: 1px solid #e8ddd0;
}
/* LINE経路バッジ */
.badge-line {
  background: #06c755;
  color: #fff;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

/* ★ トグルスイッチ */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #ccc;
  border-radius: 24px;
  transition: 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.toggle-switch input:checked + .toggle-slider {
  background: #16a34a;
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* ==========================================
   ★ 未処理LINE予約リスト
   ========================================== */

.dash-line-unproc {
  border-left: 4px solid #06c755;
  background: linear-gradient(135deg, rgba(6,199,85,0.04), rgba(6,199,85,0.01));
}
.dash-line-unproc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.dash-line-unproc-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: #3d2e1a;
  margin: 0;
}
.line-unproc-badge {
  background: #dc2626;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  min-width: 24px;
  height: 24px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  animation: pulse-badge 2s ease-in-out infinite;
}
@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
.line-unproc-row {
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff;
  margin-bottom: 6px;
  cursor: pointer;
  border: 1px solid #e8ddd0;
  transition: background 0.15s, box-shadow 0.15s;
}
.line-unproc-row:hover {
  background: #fdf8f0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.line-unproc-row:active {
  background: #f5ede2;
}
.line-unproc-main {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.line-unproc-name {
  font-weight: 700;
  font-size: 14px;
  color: #3d2e1a;
}
.line-unproc-people {
  font-size: 12px;
  color: #8b7355;
  background: #f5ede2;
  padding: 1px 6px;
  border-radius: 4px;
}
.line-unproc-course {
  font-size: 12px;
  color: #6a5a4a;
}
.line-unproc-sub {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #a09080;
}
.line-unproc-ago {
  color: #c06a08;
  font-weight: 600;
}

/* ==========================================
   日報: チップ選択 & 大度マーケット
   ========================================== */
.report-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip-label {
  cursor: pointer;
}
.chip-label input[type="checkbox"] {
  display: none;
}
.chip {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 13px;
  border: 1.5px solid var(--border-main, #c9b99a);
  color: var(--text-secondary, #8b7355);
  background: transparent;
  transition: all 0.15s;
  user-select: none;
  cursor: pointer;
  min-height: 36px;
  line-height: 1.4;
}
.chip-active {
  background: linear-gradient(135deg, #c06a08, #d4a55a);
  color: #fff;
  border-color: #c06a08;
}
.market-competitor-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-light, #e8ddd0);
}
.market-competitor-row:last-child {
  border-bottom: none;
}
.market-comp-name {
  min-width: 100px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #3a2a1a);
}
.market-comp-fields {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}
.market-comp-fields input,
.market-comp-fields select {
  font-size: 13px;
  padding: 4px 6px;
  border: 1px solid var(--border-main, #c9b99a);
  border-radius: 6px;
  background: var(--bg-card, #faf6f0);
  color: var(--text-primary, #3a2a1a);
}
.market-comp-fields input:focus,
.market-comp-fields select:focus {
  border-color: #c06a08;
  outline: none;
}
@media (max-width: 600px) {
  .market-competitor-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .market-comp-name {
    min-width: auto;
  }
}

/* ===== 日報Googleフォーム連携 ===== */
.rpt-section { margin: 16px 0; border-bottom: 1px solid var(--border-color, #e0d8cf); padding-bottom: 12px; }
.rpt-section:last-child { border-bottom: none; }
.rpt-section-title { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }

.rpt-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; margin-bottom: 4px; min-height: 36px; }
.rpt-row label { flex: 0 0 130px; font-size: 12px; font-weight: 600; color: var(--gray-600); }
.rpt-row span { font-size: 14px; font-weight: 600; }

/* 色分け: 自動=緑背景、推定=黄背景、手動=白 */
.rpt-auto { background: #e8f5e9; }
.rpt-estimate { background: #fff8e1; }
.rpt-manual { background: var(--bg-card, #fff); }

.rpt-input { font-size: 14px; padding: 4px 8px; border: 1px solid var(--border-color, #ccc); border-radius: 4px; flex: 1; min-width: 0; background: #fff; }
.rpt-input:focus { border-color: var(--primary, #3b82f6); outline: none; box-shadow: 0 0 0 2px rgba(59,130,246,0.15); }
input[type="number"].rpt-input { width: 70px; flex: 0 0 70px; }
textarea.rpt-input { width: 100%; }
select.rpt-input { flex: 0 0 120px; }

/* 性別×年齢グリッド */
.rpt-age-grid { width: 100%; }
.rpt-age-header { display: grid; grid-template-columns: 90px 1fr 1fr; gap: 4px; font-size: 11px; font-weight: 700; color: var(--gray-500); margin-bottom: 4px; text-align: center; }
.rpt-age-row { display: grid; grid-template-columns: 90px 1fr 1fr; gap: 4px; margin-bottom: 3px; padding: 3px 6px; border-radius: 4px; }
.rpt-age-label { font-size: 12px; font-weight: 600; display: flex; align-items: center; }
.rpt-age-input { width: 100% !important; flex: unset !important; text-align: center; }

/* ナイトテーマ: テキスト色反転 */
[data-theme="night"] body { color: var(--gray-800); }
[data-theme="night"] .bottom-nav { background: #1a1a2e; border-color: rgba(120,120,200,0.15); }
[data-theme="night"] .nav-item { color: #9090b0; }
[data-theme="night"] .nav-item.active { color: var(--primary); }
[data-theme="night"] input, [data-theme="night"] select, [data-theme="night"] textarea {
  background: #20203a; color: #e8e8f4; border-color: rgba(120,120,200,0.2);
}
[data-theme="night"] .card, [data-theme="night"] .settings-card { background: var(--card); }
[data-theme="night"] .page-header h2 { color: #e8e8f4; }
[data-theme="night"] .hint { color: #9090b0; }
[data-theme="night"] .tab-bar button { color: #b0b0cc; background: #20203a; }
[data-theme="night"] .tab-bar button.active { color: var(--primary); background: #2a2a48; }

/* ==========================================
   ★ v40: LINE風チャットUI
   ========================================== */

/* --- トーク一覧 --- */
.lc-list-page { padding-bottom: 12px; }
.lc-talk-list { margin-top: 4px; }
.lc-loading { text-align: center; padding: 40px 16px; font-size: 13px; color: var(--gray-400); }
.lc-empty { text-align: center; padding: 60px 16px; color: var(--gray-400); font-size: 14px; }

.lc-talk-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--card);
  border-bottom: 1px solid var(--border, #e8ddd0);
  cursor: pointer;
  transition: background 0.12s;
}
.lc-talk-row:first-child { border-radius: var(--radius-lg, 10px) var(--radius-lg, 10px) 0 0; }
.lc-talk-row:last-child { border-radius: 0 0 var(--radius-lg, 10px) var(--radius-lg, 10px); border-bottom: none; }
.lc-talk-row:only-child { border-radius: var(--radius-lg, 10px); }
.lc-talk-row:hover { background: rgba(0,0,0,0.02); }
.lc-talk-row:active { background: rgba(0,0,0,0.05); }
.lc-talk-row.lc-unread { background: #fefcf8; }
[data-theme="night"] .lc-talk-row.lc-unread { background: #2a2a48; }

.lc-talk-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
  letter-spacing: -1px;
}
.lc-talk-body { flex: 1; min-width: 0; }
.lc-talk-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.lc-talk-name { font-size: 14px; font-weight: 600; color: var(--gray-800, #3d2e1a); }
.lc-talk-time { font-size: 11px; color: var(--gray-400, #a09080); flex-shrink: 0; }
.lc-talk-preview { font-size: 12px; color: var(--gray-500, #8b7355); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-talk-dot { width: 10px; height: 10px; border-radius: 50%; background: #06c755; flex-shrink: 0; }
/* ★ v59: 未読件数バッジ */
.lc-talk-badge {
  min-width: 20px; height: 20px; border-radius: 10px;
  background: #06c755; color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 6px; flex-shrink: 0;
}

/* --- チャット画面 --- */
.lc-chat-page {
  display: flex; flex-direction: column;
  height: calc(100vh - var(--header-h, 52px) - var(--nav-h, 58px) - env(safe-area-inset-bottom, 0px));
  margin: -12px -12px 0;
}
.lc-chat-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: var(--card);
  border-bottom: 1px solid var(--border, #e8ddd0);
  flex-shrink: 0;
}
.lc-back-btn {
  background: none; border: none; font-size: 20px; cursor: pointer;
  color: var(--primary, #c06a08); padding: 4px 8px; line-height: 1;
}
.lc-chat-header-name { flex: 1; font-size: 16px; font-weight: 700; color: var(--gray-800, #3d2e1a); }

.lc-chat-messages {
  flex: 1; overflow-y: auto;
  padding: 12px;
  background: linear-gradient(180deg, rgba(245,237,226,0.15) 0%, rgba(245,237,226,0.05) 100%);
  -webkit-overflow-scrolling: touch;
}
.lc-empty-chat { text-align: center; padding: 40px 16px; color: var(--gray-400); font-size: 13px; }

/* 日付区切り */
.lc-date-divider {
  text-align: center; font-size: 11px; color: var(--gray-400, #a09080);
  padding: 12px 0 6px;
}
.lc-date-divider::before {
  content: ''; display: inline-block;
  width: 40px; height: 1px; background: var(--border, #e8ddd0);
  vertical-align: middle; margin-right: 8px;
}
.lc-date-divider::after {
  content: ''; display: inline-block;
  width: 40px; height: 1px; background: var(--border, #e8ddd0);
  vertical-align: middle; margin-left: 8px;
}

/* メッセージバブル */
.lc-msg { display: flex; flex-direction: column; margin-bottom: 8px; max-width: 82%; }
.lc-msg-recv { align-self: flex-start; }
.lc-msg-send { align-self: flex-end; }

.lc-msg-bubble {
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
}
.lc-msg-recv .lc-msg-bubble {
  background: var(--card, #fff);
  color: var(--gray-800, #3d2e1a);
  border: 1px solid var(--border, #e8ddd0);
  border-top-left-radius: 4px;
}
.lc-msg-send .lc-msg-bubble {
  background: #06c755;
  color: #fff;
  border-top-right-radius: 4px;
}
.lc-msg-auto .lc-msg-bubble {
  background: #7ed89e;
  color: #064e20;
}

/* pending状態 */
.lc-msg-pending .lc-msg-bubble {
  opacity: 0.7;
  outline: 2px dashed #06c755;
  outline-offset: 2px;
}

.lc-msg-meta { display: flex; align-items: center; gap: 4px; margin-top: 3px; }
.lc-msg-recv .lc-msg-meta { justify-content: flex-start; }
.lc-msg-send .lc-msg-meta { justify-content: flex-end; }
.lc-msg-time { font-size: 10px; color: var(--gray-400, #a09080); }
.lc-auto-tag {
  font-size: 10px; padding: 1px 7px; border-radius: 8px;
  background: #e8f5e9; color: #2e7d32; font-weight: 600;
}

/* --- 取り消しバー --- */
.lc-undo-bar {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 10px 16px;
  background: #fff8e1;
  border-top: 1px solid #ffe082;
  flex-shrink: 0;
}
.lc-undo-text { font-size: 13px; color: #6d4c00; }
.lc-undo-timer { font-size: 15px; font-weight: 700; color: #bf8000; font-variant-numeric: tabular-nums; min-width: 16px; text-align: center; }
.lc-undo-btn {
  font-size: 13px; font-weight: 600;
  color: #dc2626; background: #fff;
  border: 1px solid #dc2626; border-radius: 18px;
  padding: 5px 18px; cursor: pointer;
  transition: background 0.12s;
}
.lc-undo-btn:hover { background: #fef2f2; }

/* --- 入力エリア --- */
.lc-chat-input-area {
  padding: 8px 12px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--card, #fff);
  border-top: 1px solid var(--border, #e8ddd0);
  flex-shrink: 0;
}
.lc-chat-toolbar { display: flex; gap: 6px; margin-bottom: 6px; }
.lc-tool-btn {
  font-size: 12px; padding: 5px 12px;
  border-radius: 16px;
  border: 1px solid var(--border, #d4c4a8);
  background: var(--card, #fff);
  color: var(--gray-600, #6b5a3e);
  cursor: pointer;
  transition: all 0.12s;
  font-weight: 600;
}
.lc-tool-btn:hover { background: var(--gray-50, #f9f6f2); }
.lc-tool-btn:active { transform: scale(0.97); }
.lc-tool-ai {
  background: linear-gradient(135deg, #eeedfe, #e6f1fb);
  border-color: #afa9ec;
  color: #534ab7;
}
.lc-tool-ai:hover { background: linear-gradient(135deg, #e0dffe, #d6e6fa); }

.lc-chat-input-row { display: flex; align-items: flex-end; gap: 8px; }
.lc-input {
  flex: 1;
  border: 1px solid var(--border, #d4c4a8);
  border-radius: 20px;
  padding: 9px 16px;
  font-size: 14px;
  resize: none;
  background: var(--gray-50, #f9f6f2);
  color: var(--gray-800, #3d2e1a);
  min-height: 38px;
  max-height: 120px;
  line-height: 1.4;
  font-family: inherit;
  transition: border-color 0.12s;
}
.lc-input:focus { outline: none; border-color: var(--primary, #c06a08); }
.lc-send-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #06c755;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform 0.1s, background 0.12s;
}
.lc-send-btn:hover { background: #05b34c; }
.lc-send-btn:active { transform: scale(0.92); }

/* テンプレ選択 */
.lc-tpl-select {
  width: 100%; font-size: 13px; padding: 8px 10px;
  border-radius: 8px; border: 1px solid var(--border, #d4c4a8);
  background: var(--card, #fff); color: var(--gray-800);
  margin-bottom: 6px;
}

/* --- AI提案カード --- */
.lc-ai-loading { font-size: 12px; color: var(--gray-500); padding: 8px 4px; }
.lc-ai-ref { font-size: 11px; color: var(--gray-400); padding: 4px 0; }
.lc-ai-card {
  padding: 10px 12px; margin-bottom: 6px;
  background: linear-gradient(135deg, rgba(102,126,234,0.06), rgba(118,75,162,0.06));
  border: 1px solid rgba(102,126,234,0.18);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.12s;
}
.lc-ai-card:hover { border-color: rgba(102,126,234,0.4); background: linear-gradient(135deg, rgba(102,126,234,0.1), rgba(118,75,162,0.1)); }
.lc-ai-card:active { transform: scale(0.98); }
.lc-ai-label { font-size: 12px; font-weight: 700; color: #534ab7; margin-bottom: 3px; }
.lc-ai-text { font-size: 13px; color: var(--gray-700, #4a3c28); line-height: 1.5; white-space: pre-wrap; }
.lc-ai-close {
  display: block; width: 100%; margin-top: 4px;
  padding: 6px; font-size: 12px; text-align: center;
  background: none; border: 1px solid var(--border, #d4c4a8);
  border-radius: 8px; cursor: pointer; color: var(--gray-500);
}

/* --- テンプレートプレビューモーダル --- */
.lc-tpl-preview-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1100;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.lc-tpl-preview-modal {
  background: var(--card, #fff);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.2);
  width: 100%; max-width: 520px;
  max-height: 85vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.lc-tpl-preview-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border, #e8ddd0);
}
.lc-tpl-preview-title {
  font-size: 15px; font-weight: 700; color: var(--gray-800, #3d2e1a);
}
.lc-tpl-preview-close {
  font-size: 18px; line-height: 1;
  background: none; border: none;
  color: var(--gray-400, #a09080);
  cursor: pointer; padding: 4px 8px;
}
.lc-tpl-preview-body {
  flex: 1; min-height: 180px;
  padding: 16px 18px;
  font-size: 14px; line-height: 1.75;
  color: var(--gray-700, #4a3c28);
  border: none; resize: none;
  background: var(--gray-50, #f9f6f2);
  font-family: inherit;
  overflow-y: auto;
}
.lc-tpl-preview-body:focus { outline: none; background: #fff; }
.lc-tpl-preview-footer {
  display: flex; gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border, #e8ddd0);
  justify-content: flex-end;
  flex-wrap: wrap;
}
.lc-tpl-preview-cancel {
  font-size: 13px; padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border, #d4c4a8);
  background: var(--card, #fff);
  color: var(--gray-600, #6b5a3e);
  cursor: pointer; font-weight: 600;
}
.lc-tpl-preview-edit {
  font-size: 13px; padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #d4a55a;
  background: #fef8f0;
  color: #854F0B;
  cursor: pointer; font-weight: 600;
}
.lc-tpl-preview-send {
  font-size: 13px; padding: 8px 20px;
  border-radius: 8px;
  border: none;
  background: #06c755;
  color: #fff;
  cursor: pointer; font-weight: 700;
  transition: background 0.12s;
}
.lc-tpl-preview-send:hover { background: #05b34c; }
.lc-tpl-preview-send:active { transform: scale(0.97); }

/* --- ナイトテーマ --- */
[data-theme="night"] .lc-tpl-preview-modal { background: #1e1e34; }
[data-theme="night"] .lc-tpl-preview-header { border-color: rgba(120,120,200,0.2); }
[data-theme="night"] .lc-tpl-preview-title { color: #e8e8f4; }
[data-theme="night"] .lc-tpl-preview-body { background: #16162a; color: #d8d8e8; }
[data-theme="night"] .lc-tpl-preview-body:focus { background: #1a1a32; }
[data-theme="night"] .lc-tpl-preview-footer { border-color: rgba(120,120,200,0.2); }
[data-theme="night"] .lc-tpl-preview-cancel { background: #2a2a48; color: #c0c0d8; border-color: rgba(120,120,200,0.3); }
[data-theme="night"] .lc-tpl-preview-edit { background: #2a2520; color: #d4a55a; border-color: rgba(200,160,80,0.3); }

/* --- コンテキストメニュー --- */
.lc-ctx-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.lc-ctx-menu {
  background: var(--card, #fff);
  border-radius: 12px;
  min-width: 200px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  overflow: hidden;
}
.lc-ctx-item {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--gray-800, #3d2e1a);
  cursor: pointer;
  transition: background 0.1s;
}
.lc-ctx-item:hover { background: var(--gray-50, #f9f6f2); }
.lc-ctx-item:active { background: var(--gray-100, #f0ebe3); }
.lc-ctx-danger { color: #dc2626 !important; }
.lc-ctx-divider { height: 1px; background: var(--border, #e8ddd0); }

/* --- デスクトップ調整 --- */
@media (min-width: 768px) {
  .lc-chat-page {
    height: calc(100vh - var(--header-h, 52px) - 16px);
    margin: -12px -12px 0;
    max-width: 600px;
  }
  .lc-talk-row { padding: 14px 18px; }
  .lc-msg { max-width: 65%; }
}

/* --- ナイトテーマ --- */
[data-theme="night"] .lc-chat-messages { background: linear-gradient(180deg, rgba(30,30,50,0.3) 0%, rgba(20,20,40,0.1) 100%); }
[data-theme="night"] .lc-msg-recv .lc-msg-bubble { background: #2a2a48; color: #e8e8f4; border-color: rgba(120,120,200,0.2); }
[data-theme="night"] .lc-msg-send .lc-msg-bubble { background: #06a04a; }
[data-theme="night"] .lc-msg-auto .lc-msg-bubble { background: #065f30; color: #b8f0cc; }
[data-theme="night"] .lc-undo-bar { background: #2a2a20; border-color: rgba(200,180,100,0.2); }
[data-theme="night"] .lc-undo-text { color: #c0a060; }
[data-theme="night"] .lc-auto-tag { background: #1a3a20; color: #80d090; }
[data-theme="night"] .lc-date-divider { color: #8080a0; }
[data-theme="night"] .lc-ctx-menu { background: #20203a; }
[data-theme="night"] .lc-ctx-item { color: #e8e8f4; }
[data-theme="night"] .lc-ctx-item:hover { background: #2a2a48; }
[data-theme="night"] .lc-ai-card { background: rgba(80,60,140,0.15); border-color: rgba(102,126,234,0.25); }
[data-theme="night"] .lc-talk-row.lc-unread { background: #252540; }

/* ===== v48: 便・チーム管理スタイル ===== */
.trip-block {
  margin-bottom: 20px;
  border: 1px solid var(--border-light, #e0d5c8);
  border-radius: 12px;
  overflow: visible;
  background: var(--bg-card, #fff);
}
.trip-block > .trip-header {
  border-radius: 12px 12px 0 0;
  overflow: hidden;
}
.trip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  color: #fff;
  font-weight: 700;
}
.trip-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.trip-label {
  font-size: 14px;
  opacity: 0.9;
}
.trip-time-display {
  font-size: 17px;
  letter-spacing: 0.5px;
}
.trip-time-display s {
  text-decoration: line-through;
}
.trip-summary {
  font-size: 12px;
  background: rgba(255,255,255,0.25);
  padding: 2px 8px;
  border-radius: 8px;
}
.trip-header-right .btn {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.4);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.trip-header-right .btn:hover {
  background: rgba(255,255,255,0.35);
}
.trip-footer {
  padding: 8px 16px;
  border-top: 1px dashed var(--border-light, #e0d5c8);
  text-align: center;
}
.team-card {
  border-bottom: 1px solid var(--border-light, #e0d5c8);
}
.team-card:last-of-type {
  border-bottom: none;
}
.team-card-header {
  padding: 10px 16px;
  background: var(--bg-card-alt, rgba(0,0,0,0.02));
  border-bottom: 1px solid var(--border-light, #e0d5c8);
}
.team-card-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.team-card-icon {
  font-size: 16px;
}
.team-card-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-dark, #9a5406);
}
.team-card-count {
  font-size: 11px;
  color: var(--gray-500, #888);
  background: var(--bg-card, #f5f0ea);
  padding: 1px 6px;
  border-radius: 6px;
}
.team-card-staff {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--gray-600, #666);
}
.team-card-staff label {
  font-weight: 600;
  font-size: 11px;
  color: var(--gray-500, #888);
}
.team-card-staff select {
  font-size: 13px;
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid var(--border-light, #d0c5b8);
  background: var(--bg-card, #fff);
  min-width: 80px;
}
.team-card-meeting {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
}
.team-card-meeting label {
  font-weight: 600;
  font-size: 11px;
  color: var(--gray-500);
}
.team-card-meeting input,
.team-card-meeting select {
  font-size: 13px;
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid var(--border-light, #d0c5b8);
  background: var(--bg-card, #fff);
}
.team-card-members {
  padding: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.team-card-members .invoice-table {
  margin: 0;
}
.team-card-members .invoice-table td {
  font-size: 12px;
  white-space: nowrap;
}
.team-card-members .invoice-table th {
  font-size: 10px;
}
.team-card-actions {
  padding: 6px 16px;
  text-align: right;
  background: var(--bg-card-alt, rgba(0,0,0,0.02));
}
.team-move-btn {
  font-size: 11px !important;
  padding: 3px 10px !important;
}
.team-remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  opacity: 0.5;
  padding: 0 4px;
}
.team-remove-btn:hover {
  opacity: 1;
}

/* モバイル調整 */
@media (max-width: 600px) {
  .trip-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .trip-header-right {
    align-self: flex-end;
  }
  .team-card-staff {
    font-size: 11px;
  }
  .team-card-staff select {
    font-size: 12px;
    min-width: 70px;
  }
  .team-card-meeting {
    font-size: 11px;
  }
  .team-card-members .invoice-table td {
    font-size: 11px;
    padding: 2px 3px;
  }
}

/* 印刷用 */
@media print {
  .pdf-hide { display: none !important; }
  .team-card-staff-print { display: block !important; }
  .trip-header-right { display: none !important; }
  .team-card-actions { display: none !important; }
}

/* ★ v49: ドラッグ&ドロップ */
.draggable-member {
  cursor: grab;
  transition: opacity 0.2s, background 0.15s;
  -webkit-user-select: none;
  user-select: none;
}
.draggable-member:active { cursor: grabbing; }
.draggable-member.dragging {
  opacity: 0.3;
  background: var(--gray-100);
}
.team-card.drop-target-hint {
  outline: 2px dashed var(--gray-300);
  outline-offset: -2px;
  transition: outline-color 0.2s, background 0.2s;
}
.team-card.drop-target-active {
  outline-color: var(--accent);
  background: rgba(192, 106, 8, 0.06);
}

/* タッチD&D: ゴースト要素 */
.touch-drag-ghost {
  position: fixed;
  z-index: 99999;
  padding: 6px 14px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  border-radius: 20px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  pointer-events: none;
  white-space: nowrap;
  opacity: 0.92;
  transform: translateY(-50%);
}
/* タッチD&D中のスクロール抑止 */
body.touch-dragging {
  overflow: hidden;
  touch-action: none;
}

/* ===== ★ v55: データ品質警告バナー ===== */
.dash-quality-alert {
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 8px;
}
.dash-quality-warn {
  background: #fefce8;
  border: 1px solid #fde047;
}
.dash-quality-error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
}

/* ==========================================
   ★ v60: 領収書モーダル・プレビュー
   ========================================== */

/* 領収書ボタン */
.btn-receipt {
  background: #fef3c7 !important;
  color: #92400e !important;
  border: 1px solid #f59e0b !important;
  font-weight: 600;
}
.btn-receipt:hover { background: #fde68a !important; }

/* モーダルオーバーレイ */
.receipt-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: rcpFadeIn 0.2s ease;
}
@keyframes rcpFadeIn { from { opacity: 0; } to { opacity: 1; } }

.receipt-modal {
  background: var(--white, #fff);
  border-radius: var(--radius-lg, 16px);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.receipt-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--gray-100, #f3f4f6);
}
.receipt-modal-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}
.receipt-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--gray-400, #9ca3af);
  padding: 4px 8px;
  border-radius: 8px;
}
.receipt-modal-close:hover { background: var(--gray-100, #f3f4f6); }

/* 編集フォーム */
.receipt-modal-edit {
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--gray-50, #f9fafb);
  border-bottom: 1px solid var(--gray-100, #f3f4f6);
}
.receipt-edit-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.receipt-edit-row label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600, #4b5563);
  min-width: 60px;
  flex-shrink: 0;
}
.receipt-edit-row .settings-input {
  flex: 1;
}
.receipt-sama {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-700, #374151);
  flex-shrink: 0;
}

/* プレビューラップ */
.receipt-preview-wrap {
  padding: 16px 20px;
  overflow-x: auto;
}
.receipt-preview {
  background: #fff;
}

/* ===== 領収書PDF用HTML（プレビュー＋html2canvas用） ===== */
.rcp-paper {
  position: relative;
  font-family: 'Noto Sans JP', 'M PLUS Rounded 1c', sans-serif;
  color: #1a1a1a;
  padding: 28px 24px 20px;
  border: 2px solid #333;
  border-radius: 4px;
  background: #fff;
  min-width: 460px;
}

.rcp-title {
  text-align: center;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.3em;
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 3px double #333;
}

.rcp-addressee {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #333;
}
.rcp-addressee-name {
  font-size: 20px;
  font-weight: 700;
  flex: 1;
}
.rcp-sama {
  font-size: 16px;
  font-weight: 500;
}

.rcp-grand-total-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin-bottom: 16px;
  border: 2px solid #333;
  border-radius: 4px;
  background: #fafafa;
}
.rcp-grand-label {
  font-size: 14px;
  font-weight: 600;
}
.rcp-grand-amount {
  font-size: 24px;
  font-weight: 800;
}

.rcp-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.rcp-meta-row {
  display: flex;
  gap: 12px;
  font-size: 13px;
}
.rcp-meta-label {
  font-weight: 600;
  min-width: 60px;
  color: #555;
}

.rcp-but {
  font-size: 13px;
  margin-bottom: 14px;
  color: #444;
}

/* 明細テーブル */
.rcp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 16px;
}
.rcp-table th {
  background: #f0f0f0;
  border: 1px solid #ccc;
  padding: 6px 8px;
  font-weight: 700;
  text-align: left;
  font-size: 12px;
}
.rcp-table td {
  border: 1px solid #ddd;
  padding: 6px 8px;
}
.rcp-table tfoot td {
  border-top: 2px solid #333;
  background: #fafafa;
}
.rcp-discount td {
  color: #dc2626;
}

/* フッター（発行者情報 + 印影） */
.rcp-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #ccc;
  position: relative;
}
.rcp-issuer {
  font-size: 12px;
  line-height: 1.8;
  color: #444;
  position: relative;
  z-index: 1;
}
.rcp-shop-name {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a1a;
}
.rcp-company { font-weight: 500; }
.rcp-invoice-num {
  font-weight: 600;
  color: #1a1a1a;
}

/* 印影画像 — 発行者名の下レイヤー */
.rcp-seal {
  position: absolute;
  right: 35%;
  top: 17px;
  z-index: 0;
}
.rcp-seal-img {
  width: 90px;
  height: 90px;
  object-fit: contain;
  opacity: 0.75;
}

/* アクションボタン */
.receipt-modal-actions {
  display: flex;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--gray-100, #f3f4f6);
  flex-wrap: wrap;
}
.receipt-modal-actions .btn {
  flex: 1;
  min-width: 100px;
  font-size: 13px;
}

/* 送信ステータス */
.receipt-send-status {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  border-top: 1px solid var(--gray-100, #f3f4f6);
  color: var(--gray-600, #4b5563);
  background: var(--gray-50, #f9fafb);
}
.receipt-status-ok {
  color: #16a34a !important;
  background: #f0fdf4 !important;
}
.receipt-status-err {
  color: #dc2626 !important;
  background: #fef2f2 !important;
}

/* モバイル対応 */
@media (max-width: 600px) {
  .receipt-modal {
    max-width: 100%;
    max-height: 95vh;
    border-radius: 16px 16px 0 0;
    margin-top: auto;
  }
  .receipt-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .rcp-paper {
    min-width: auto;
    padding: 20px 16px;
    font-size: 12px;
  }
  .rcp-title { font-size: 22px; }
  .rcp-grand-amount { font-size: 20px; }
  .rcp-addressee-name { font-size: 17px; }
  .receipt-modal-actions {
    flex-direction: column;
  }
  .receipt-modal-actions .btn {
    width: 100%;
  }
  .rcp-seal-img {
    width: 72px;
    height: 72px;
  }
}

/* 印影アップロード */
.rct-seal-upload-area {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
}
.rct-seal-preview {
  width: 80px;
  height: 80px;
  border: 2px dashed var(--gray-300, #d1d5db);
  border-radius: var(--radius, 8px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-50, #f9fafb);
  overflow: hidden;
  flex-shrink: 0;
}
.rct-seal-preview-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.rct-seal-placeholder {
  font-size: 11px;
  color: var(--gray-400, #9ca3af);
  text-align: center;
}
.rct-seal-btns {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rct-seal-upload-btn {
  cursor: pointer;
}
