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

:root {
  --primary: #1a1a2e;
  --accent: #c8a96e;
  --accent2: #e8c98e;
  --success: #2ecc71;
  --danger: #e74c3c;
  --warning: #f39c12;
  --info: #3498db;
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --text: #2c3e50;
  --text-light: #7f8c8d;
  --border: #e0e4ea;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
}

html { font-size: 14px; }
body {
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ===== Header ===== */
.header {
  background: var(--primary);
  color: #fff;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.logo {
  display: flex;
  align-items: center;
}
.logo-text {
  font-family: 'Times New Roman', 'Georgia', serif;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #fff;
  line-height: 1;
  text-transform: uppercase;
}
.subtitle {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.6);
  font-weight: 300;
}
.header-right { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.current-month-badge {
  background: var(--accent);
  color: var(--primary);
  padding: 5px 14px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.last-update {
  color: rgba(255,255,255,0.5);
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ===== Summary Cards ===== */
.summary-section {
  max-width: 1400px;
  margin: 20px auto 0;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
.summary-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}
.summary-card:hover { transform: translateY(-2px); }
.summary-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.summary-card.total .summary-icon { background: #e8f4fd; color: var(--info); }
.summary-card.achieved .summary-icon { background: #e8faf0; color: var(--success); }
.summary-card.not-achieved .summary-icon { background: #fdecea; color: var(--danger); }
.summary-card.rate .summary-icon { background: #fef9e7; color: var(--warning); }
.summary-card.total-posts .summary-icon { background: #f4eeff; color: #9b59b6; }
.summary-label { font-size: 0.78rem; color: var(--text-light); margin-bottom: 4px; }
.summary-value { font-size: 1.6rem; font-weight: 700; color: var(--text); line-height: 1; }

/* ===== Brand Mini Summary ===== */
.brand-mini-summary-section {
  max-width: 1400px;
  margin: 14px auto 0;
  padding: 0 24px;
}
.brand-mini-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.brand-mini-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border-left: 4px solid #ccc;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  user-select: none;
}
.brand-mini-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.bmc-top {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
}
.bmc-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.bmc-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}
.bmc-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.bmc-stat { text-align: center; }
.bmc-stat-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.bmc-stat-label {
  font-size: 0.7rem;
  color: var(--text-light);
  margin-top: 1px;
}

/* ===== Controls ===== */
.controls-section {
  max-width: 1400px;
  margin: 18px auto 0;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.controls-left, .controls-right { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #2a2a4e; }
.btn-outline { background: #fff; color: var(--text); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #27ae60; }
.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: #2980b9; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #e08e0b; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn i.fa-spin { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ===== 目標値クイック編集（テーブル内） ===== */
.td-target {
  position: relative;
  text-align: center;
  white-space: nowrap;
}
.td-target:hover .target-edit-btn { opacity: 1; }
.target-val { vertical-align: middle; }
.target-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  font-size: 0.7rem;
  padding: 2px 4px;
  margin-left: 4px;
  border-radius: 4px;
  opacity: 0;
  transition: all 0.15s;
  vertical-align: middle;
}
.target-edit-btn:hover { background: var(--border); color: var(--accent); }
.quick-edit-wrap {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.quick-edit-input {
  width: 58px;
  padding: 3px 6px;
  border: 1.5px solid var(--accent);
  border-radius: 5px;
  font-size: 0.88rem;
  font-family: 'Noto Sans JP', sans-serif;
  text-align: center;
  outline: none;
  background: #fffdf7;
}
.quick-edit-ok, .quick-edit-cancel {
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 4px;
  font-size: 0.78rem;
  transition: background 0.15s;
  line-height: 1;
}
.quick-edit-ok { color: var(--success); }
.quick-edit-ok:hover { background: #e8faf0; }
.quick-edit-cancel { color: var(--danger); }
.quick-edit-cancel:hover { background: #fdecea; }

/* ===== Progress ===== */
.progress-section {
  max-width: 1400px;
  margin: 14px auto 0;
  padding: 0 24px;
}
.progress-bar-wrap {
  background: var(--border);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 6px;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 999px;
  transition: width 0.4s ease;
  width: 0%;
}
.progress-text { font-size: 0.82rem; color: var(--text-light); text-align: right; }

/* ===== Filter ===== */
.filter-section {
  max-width: 1400px;
  margin: 16px auto 0;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.filter-left { display: flex; gap: 8px; }
.filter-btn {
  padding: 6px 16px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text-light);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn.active, .filter-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.search-input {
  padding: 7px 14px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.83rem;
  outline: none;
  width: 200px;
  transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--accent); }

/* ===== Table ===== */
.table-section {
  max-width: 1400px;
  margin: 14px auto 40px;
  padding: 0 24px;
}
.main-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.main-table thead tr {
  background: var(--primary);
  color: #fff;
}
.main-table th {
  padding: 13px 16px;
  text-align: left;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.main-table th:hover { background: #2a2a4e; }
.sort-icon { font-size: 0.7rem; opacity: 0.5; margin-left: 4px; }
.th-rank { width: 48px; cursor: default; }
.th-rank:hover { background: var(--primary) !important; }
.th-name { min-width: 120px; }
.th-target, .th-count { width: 110px; text-align: center; }
.th-status { width: 110px; text-align: center; }
.th-progress { width: 160px; }

.main-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.main-table tbody tr:last-child { border-bottom: none; }
.main-table tbody tr:hover { background: #f8f9fb; }
.main-table tbody tr.hidden { display: none; }

.main-table td {
  padding: 11px 16px;
  font-size: 0.88rem;
  vertical-align: middle;
}
.td-rank { color: var(--text-light); font-size: 0.8rem; font-weight: 500; }
.td-name { font-weight: 600; color: var(--text); }
.td-target, .td-count { text-align: center; font-weight: 600; }
.td-count { font-size: 1.05rem; }
.td-count.loading { color: var(--text-light); }
.td-count.error { color: var(--danger); font-size: 0.8rem; }
.td-status { text-align: center; font-size: 1.3rem; }

/* Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.status-achieved { background: #e8faf0; color: var(--success); }
.status-not-achieved { background: #fdecea; color: var(--danger); }
.status-waiting { background: #f0f2f5; color: var(--text-light); }
.status-zero { background: #fef9e7; color: var(--warning); }

/* Progress bar cell */
.cell-progress { min-width: 140px; }
.cell-progress-bar-wrap {
  background: var(--border);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
  margin-bottom: 3px;
}
.cell-progress-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease;
}
.cell-progress-bar.achieved { background: var(--success); }
.cell-progress-bar.partial { background: var(--warning); }
.cell-progress-bar.zero { background: var(--border); }
.cell-progress-label { font-size: 0.72rem; color: var(--text-light); }

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal-content {
  background: #fff;
  border-radius: var(--radius);
  max-width: 900px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-light);
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
}
.modal-close:hover { background: #f0f2f5; color: var(--text); }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ===== モーダルサイズバリエーション ===== */
.modal-wide { max-width: 700px; }
.modal-sm  { max-width: 480px; }

/* ===== 目標値エディタ（モーダル内テーブル） ===== */
.target-editor-info {
  background: #f0f6ff;
  border: 1px solid #c3d9ff;
  color: #1a4a9a;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.84rem;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.target-editor-info i { margin-top: 2px; flex-shrink: 0; }
.target-editor-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.target-edit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.target-edit-table th {
  background: #f0f2f5;
  padding: 9px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.target-edit-table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.target-edit-table tr:last-child td { border-bottom: none; }
.target-edit-table tr:hover td { background: #f8f9fb; }
.te-name { font-weight: 600; }
.te-current { text-align: center; color: var(--text-light); }
.te-default-hint { font-size: 0.75rem; color: var(--text-light); display: block; margin-top: 1px; }
.te-input-cell { text-align: center; }
.te-input {
  width: 80px;
  padding: 5px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: 'Noto Sans JP', sans-serif;
  text-align: center;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.te-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200,169,110,0.15);
}
.te-changed-cell { text-align: center; }
.te-changed-mark {
  background: #fff3cd;
  color: #856404;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ===== 一括設定モーダル ===== */
.bulk-input-wrap { margin-bottom: 14px; }
.bulk-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.bulk-input {
  width: 100%;
  padding: 9px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: 'Noto Sans JP', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}
.bulk-input:focus { border-color: var(--accent); }
.bulk-select-wrap { margin-bottom: 10px; }
.bulk-store-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px;
  margin-bottom: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}
.bulk-store-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.84rem;
  transition: background 0.1s;
}
.bulk-store-item:hover { background: #f0f2f5; }
.bulk-store-item input[type="checkbox"] { cursor: pointer; flex-shrink: 0; }
.bulk-current-target {
  margin-left: auto;
  color: var(--text-light);
  font-size: 0.78rem;
}
.bulk-store-controls {
  display: flex;
  gap: 6px;
}

/* Month Tabs */
.month-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.month-tab {
  padding: 5px 14px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text-light);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.month-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ===== ブランドグループヘッダー ===== */
.brand-header-row td { padding: 0 !important; border: none !important; }
.brand-header-cell {
  background: var(--brand-bg, #f8f9fb);
  border-left: 4px solid var(--brand-border, #ccc);
  padding: 10px 16px !important;
  position: sticky;
  top: 57px;   /* ヘッダーの高さ分 */
  z-index: 5;
}
.brand-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.brand-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.brand-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}
.brand-label {
  font-size: 0.75rem;
  color: var(--text-light);
  font-weight: 400;
  letter-spacing: 0.04em;
}
.brand-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.brand-stat {
  font-size: 0.8rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 4px;
}
.brand-stat-rate {
  font-weight: 700;
  font-size: 0.85rem;
}

/* 店舗行の左端インジケーター */
.store-row td:first-child { padding-left: 14px; }
.brand-indicator {
  display: inline-block;
  width: 4px;
  height: 14px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ブランドごとの行背景（ホバー時のみ色付き） */
.store-row.brand-hiro:hover td     { background: #fffdf7; }
.store-row.brand-barber:hover td   { background: #f0f6ff; }
.store-row.brand-premium:hover td  { background: #f8f3ff; }

/* ===== ブランドフィルターボタン ===== */
.brand-filter-row {
  max-width: 1400px;
  margin: 12px auto 0;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.brand-filter-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 2px;
}
.brand-filter-btn {
  padding: 5px 14px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text-light);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.brand-filter-btn .bf-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.brand-filter-btn:hover,
.brand-filter-btn.active {
  color: #fff;
}
.brand-filter-btn.all-btn:hover,
.brand-filter-btn.all-btn.active  { background: var(--primary); border-color: var(--primary); }
.brand-filter-btn.hiro-btn:hover,
.brand-filter-btn.hiro-btn.active   { background: #c8a96e; border-color: #c8a96e; }
.brand-filter-btn.barber-btn:hover,
.brand-filter-btn.barber-btn.active { background: #2c7be5; border-color: #2c7be5; }
.brand-filter-btn.premium-btn:hover,
.brand-filter-btn.premium-btn.active{ background: #6f42c1; border-color: #6f42c1; }

/* History Table */
.history-table-wrap { overflow-x: auto; }
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.history-table th {
  background: #f0f2f5;
  padding: 9px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  border-bottom: 2px solid var(--border);
}
.history-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
}
.history-table tr:last-child td { border-bottom: none; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--primary);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
  z-index: 300;
  max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--info); }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .summary-section { grid-template-columns: repeat(3, 1fr); }
  .brand-mini-summary { grid-template-columns: 1fr 1fr 1fr; }
}

/* ===== タブレット (768px以下) ===== */
@media (max-width: 768px) {
  .header-inner { padding: 12px 16px; }
  .summary-section { grid-template-columns: repeat(3, 1fr); padding: 0 12px; gap: 10px; }
  .brand-mini-summary-section,
  .controls-section, .filter-section, .table-section, .progress-section,
  .brand-filter-row { padding: 0 12px; }
  .brand-mini-summary { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .controls-section { display: none; } /* モバイルはボトムナビで代替 */
  .main-table { font-size: 0.82rem; }
  .th-progress { display: none; }
  td.cell-progress { display: none; }
  .search-input { width: 140px; }
  .brand-header-cell { top: 48px; }
}

/* ===== iPhone (480px以下) ===== */
@media (max-width: 480px) {
  html { font-size: 13px; }

  /* ヘッダー */
  .header-inner { padding: 10px 14px; gap: 6px; }
  .logo-text { font-size: 1.35rem; }
  .subtitle { font-size: 0.75rem; color: rgba(255,255,255,0.5); }
  .current-month-badge { font-size: 0.82rem; padding: 4px 10px; }
  .last-update { display: none; }

  /* サマリーカード: 3列 → コンパクト */
  .summary-section {
    grid-template-columns: repeat(3, 1fr);
    padding: 0 10px;
    gap: 8px;
    margin-top: 10px;
  }
  /* 5枚目のカード(総投稿数)は3列で2行目に */
  .summary-card {
    padding: 10px 8px;
    gap: 7px;
    border-radius: 8px;
  }
  .summary-icon {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
    border-radius: 8px;
  }
  .summary-label { font-size: 0.65rem; }
  .summary-value { font-size: 1.2rem; }

  /* ブランドミニサマリー: 横スクロール */
  .brand-mini-summary-section { padding: 0 10px; margin-top: 10px; }
  .brand-mini-summary {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    grid-template-columns: unset;
  }
  .brand-mini-summary::-webkit-scrollbar { display: none; }
  .brand-mini-card {
    min-width: 140px;
    flex-shrink: 0;
    padding: 10px 12px;
  }
  .bmc-name { font-size: 0.74rem; }
  .bmc-stat-val { font-size: 1rem; }
  .bmc-stat-label { font-size: 0.62rem; }

  /* ブランドフィルター: 横スクロール */
  .brand-filter-row {
    padding: 0 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: none;
    gap: 6px;
  }
  .brand-filter-row::-webkit-scrollbar { display: none; }
  .brand-filter-label { display: none; }
  .brand-filter-btn { white-space: nowrap; flex-shrink: 0; padding: 5px 12px; font-size: 0.78rem; }

  /* フィルターバー */
  .filter-section { padding: 0 10px; gap: 8px; }
  .filter-left { gap: 6px; }
  .filter-btn { padding: 5px 10px; font-size: 0.78rem; }
  .search-input { width: 110px; font-size: 0.82rem; }

  /* テーブル: スクロール対応 */
  .table-section { padding: 0 10px; margin-bottom: 80px; /* ボトムナビ分 */ }
  .table-scroll-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .main-table { font-size: 0.8rem; min-width: 360px; }
  .main-table th, .main-table td { padding: 9px 8px; }
  .th-rank { width: 28px; }
  .th-name { min-width: 90px; }
  .th-target, .th-count { width: 58px; }
  .th-status { width: 72px; }

  /* ブランドヘッダー行 */
  .brand-header-cell { padding: 8px 10px !important; top: 48px; }
  .brand-name { font-size: 0.82rem; }
  .brand-label { display: none; }
  .brand-stat { font-size: 0.72rem; }

  /* ステータスバッジ */
  .status-badge { padding: 2px 7px; font-size: 0.7rem; }

  /* 進捗: 非表示 */
  .th-progress, td.cell-progress { display: none; }

  /* target-edit-btn は常に表示（iPhoneはhoverなし） */
  .target-edit-btn { opacity: 1 !important; }

  /* プログレスバー */
  .progress-section { padding: 0 10px; }
  .progress-text { font-size: 0.78rem; }

  /* モーダル: 全画面表示 */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-content {
    border-radius: 20px 20px 0 0;
    max-height: 92vh;
    max-width: 100%;
    width: 100%;
  }
  .modal-wide, .modal-sm { max-width: 100%; }
  .modal-header { padding: 16px 16px 12px; }
  .modal-body { padding: 14px 16px; }
  .modal-footer { padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }

  /* Toast */
  .toast { bottom: 80px; right: 12px; left: 12px; max-width: unset; font-size: 0.85rem; }

  /* 目標値編集テーブル */
  .target-edit-table th, .target-edit-table td { padding: 6px 8px; font-size: 0.82rem; }
  .te-input { width: 66px; font-size: 0.85rem; }

  /* 一括設定の店舗リスト */
  .bulk-store-list { grid-template-columns: 1fr 1fr; }
}

/* ===== iPhone SE / 小型端末 (375px以下) ===== */
@media (max-width: 375px) {
  .summary-section { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .summary-card { padding: 8px 6px; gap: 5px; }
  .summary-value { font-size: 1.1rem; }
  .brand-mini-card { min-width: 120px; }
}

/* ===== iPhone用固定ボトムナビ ===== */
.mobile-bottom-bar { display: none; }

@media (max-width: 768px) {
  .mobile-bottom-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid var(--border);
    padding: 8px 6px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 150;
    gap: 4px;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
  }
  .mbb-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px;
    border: none;
    background: none;
    color: var(--text-light);
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 0.62rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.15s;
    min-height: 48px; /* タッチターゲット */
    -webkit-tap-highlight-color: transparent;
  }
  .mbb-btn i { font-size: 1.1rem; }
  .mbb-btn:active { background: #f0f2f5; color: var(--primary); transform: scale(0.95); }
  .mbb-btn.primary { color: var(--primary); font-weight: 700; }
  .mbb-btn.primary i { color: var(--accent); }
  /* 取得中スピナー */
  .mbb-btn.loading i { animation: spin 1s linear infinite; color: var(--accent); }
}

