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

:root {
  --primary: #1a56db;
  --primary-dark: #1e429f;
  --primary-light: #e8f0fe;
  --success: #057a55;
  --success-light: #def7ec;
  --warning: #9f580a;
  --warning-light: #fdf3c0;
  --danger: #c81e1e;
  --danger-light: #fde8e8;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --orange: #d97706;
  --orange-light: #fef3c7;
  --purple: #7c3aed;
  --purple-light: #f5f3ff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: white;
  position: relative;
}

/* ===== Header ===== */
.app-header {
  background: linear-gradient(135deg, #1a56db 0%, #1e429f 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.app-header .back-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

.app-header .back-btn:hover { background: rgba(255,255,255,0.3); }

.app-header .header-title {
  font-size: 17px;
  font-weight: 700;
  flex: 1;
}

.app-header .header-icon {
  font-size: 20px;
  opacity: 0.9;
}

/* ===== Screen Management ===== */
.screen {
  display: none;
  min-height: calc(100vh - 68px);
  padding-bottom: 32px;
}
.screen.active { display: block; }

/* ===== Top Screen ===== */
.top-hero {
  background: linear-gradient(135deg, #1a56db 0%, #1e429f 100%);
  color: white;
  padding: 32px 20px 24px;
  text-align: center;
}

.top-hero h1 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 6px;
  line-height: 1.3;
}

.top-hero p {
  font-size: 13px;
  opacity: 0.85;
}

.top-hero .hero-icon {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
}

.menu-grid {
  padding: 20px 16px;
  display: grid;
  gap: 12px;
}

.menu-card {
  background: white;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
}

.menu-card:hover, .menu-card:active {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.menu-card .menu-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.menu-card .menu-text { flex: 1; }
.menu-card .menu-title { font-size: 16px; font-weight: 700; color: var(--gray-800); margin-bottom: 2px; }
.menu-card .menu-desc { font-size: 12px; color: var(--gray-500); }
.menu-card .menu-arrow { color: var(--gray-400); font-size: 14px; }

.ic-blue { background: #dbeafe; color: #1d4ed8; }
.ic-green { background: #d1fae5; color: #065f46; }
.ic-yellow { background: #fef3c7; color: #92400e; }
.ic-red { background: #fee2e2; color: #991b1b; }
.ic-purple { background: #ede9fe; color: #6d28d9; }
.ic-teal { background: #ccfbf1; color: #0f766e; }

/* ===== Section & Cards ===== */
.section {
  padding: 20px 16px 0;
}

.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== Step Indicator ===== */
.step-indicator {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  gap: 0;
  background: white;
  border-bottom: 1px solid var(--gray-200);
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
}

.step-item:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 14px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--gray-200);
}

.step-item.done::after, .step-item.active::after { background: var(--primary); }

.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gray-200);
  color: var(--gray-500);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  z-index: 1;
  position: relative;
  transition: all 0.3s;
}

.step-item.done .step-dot { background: var(--primary); color: white; }
.step-item.active .step-dot { background: var(--primary); color: white; box-shadow: 0 0 0 4px var(--primary-light); }

.step-label {
  font-size: 10px;
  color: var(--gray-400);
  margin-top: 4px;
  font-weight: 600;
}
.step-item.active .step-label, .step-item.done .step-label { color: var(--primary); }

/* ===== Options (Radio/Checkbox style) ===== */
.option-group {
  display: grid;
  gap: 8px;
}

.option-grid-2 { grid-template-columns: 1fr 1fr; }
.option-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

.option-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-700);
  width: 100%;
}

.option-btn:hover { border-color: var(--primary); background: var(--primary-light); }

.option-btn.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
}

.option-btn .opt-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--gray-300);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  transition: all 0.2s;
}

.option-btn.selected .opt-icon {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Danger options */
.option-btn.danger { border-color: #fca5a5; }
.option-btn.danger:hover, .option-btn.danger.selected {
  border-color: var(--danger);
  background: var(--danger-light);
  color: var(--danger);
}
.option-btn.danger.selected .opt-icon { background: var(--danger); border-color: var(--danger); }

/* Three-way toggle */
.toggle-group {
  display: flex;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.toggle-btn {
  flex: 1;
  padding: 10px 6px;
  border: none;
  background: white;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
  transition: all 0.2s;
  border-right: 1px solid var(--gray-200);
}

.toggle-btn:last-child { border-right: none; }

.toggle-btn.selected {
  background: var(--primary);
  color: white;
}

.toggle-btn.selected-yes { background: var(--success); color: white; }
.toggle-btn.selected-no { background: var(--danger); color: white; }
.toggle-btn.selected-unknown { background: var(--gray-500); color: white; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  transition: all 0.2s;
  width: 100%;
  letter-spacing: 0.02em;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(26,86,219,0.3);
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(26,86,219,0.35); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-success {
  background: linear-gradient(135deg, #057a55 0%, #046c4e 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(5,122,85,0.3);
}

.btn-danger {
  background: linear-gradient(135deg, #e02424 0%, #c81e1e 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(200,30,30,0.3);
}

.btn-outline {
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover { background: var(--primary-light); }

.btn-gray {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 2px solid var(--gray-200);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 6px;
}

.btn-row {
  display: flex;
  gap: 10px;
  padding: 16px;
}

.btn-row .btn { flex: 1; }

/* ===== Result Card ===== */
.result-header {
  padding: 24px 20px;
  text-align: center;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 16px;
}

.badge-high { background: var(--success-light); color: var(--success); }
.badge-mid { background: var(--warning-light); color: var(--warning); }
.badge-low { background: var(--danger-light); color: var(--danger); }

.result-candidate {
  background: white;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.result-candidate.primary-candidate {
  border-color: var(--primary);
  background: var(--primary-light);
}

.candidate-rank {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}

.rank-1 { background: #fbbf24; color: white; }
.rank-2 { background: var(--gray-400); color: white; }

.candidate-info { flex: 1; }
.candidate-name { font-size: 16px; font-weight: 700; color: var(--gray-800); }
.candidate-score { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

.candidate-icon { font-size: 24px; }

/* ===== Accept Badge ===== */
.accept-badge {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.accept-ok { background: var(--success-light); color: var(--success); border: 2px solid #6ee7b7; }
.accept-cond { background: var(--warning-light); color: var(--warning); border: 2px solid #fcd34d; }
.accept-ng { background: var(--danger-light); color: var(--danger); border: 2px solid #fca5a5; }

/* ===== Warning Box ===== */
.warning-box {
  background: #fff7ed;
  border: 2px solid #fed7aa;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.warning-box.danger-box {
  background: var(--danger-light);
  border-color: #fca5a5;
}

.warning-box .warn-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.warning-box .warn-text { font-size: 13px; color: var(--gray-700); line-height: 1.5; }

/* 最高レベル警告（基板故障ほぼ確定など） */
.warning-box.critical-box {
  background: #1f2937;
  border-color: #dc2626;
  border-width: 2px;
}
.warning-box.critical-box .warn-text {
  color: #fef2f2;
  font-weight: 600;
}

/* 複合故障バナー */
.complex-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
  color: white;
  padding: 14px 16px;
  margin: 0 16px 12px;
  border-radius: var(--radius);
  border: 2px solid #dc2626;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}
.complex-banner-icon { font-size: 24px; flex-shrink: 0; }
.complex-banner-title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 3px;
}
.complex-banner-sub {
  font-size: 12px;
  opacity: 0.85;
  line-height: 1.4;
}

.info-box {
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--gray-700);
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

/* ===== Template Box ===== */
.template-box {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--gray-700);
  margin-bottom: 12px;
  position: relative;
}

.template-box .copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  font-weight: 600;
}

/* ===== Checklist ===== */
.checklist {
  display: grid;
  gap: 8px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  background: white;
}

.check-item:hover { border-color: var(--primary); }

.check-item.checked {
  background: var(--success-light);
  border-color: #6ee7b7;
}

.check-box {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--gray-300);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.check-item.checked .check-box {
  background: var(--success);
  border-color: var(--success);
  color: white;
  font-size: 12px;
}

.check-label { font-size: 14px; font-weight: 500; color: var(--gray-700); flex: 1; }
.check-item.checked .check-label { color: var(--success); }

/* ===== Flow List (Troubleshoot) ===== */
.flow-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}

.flow-card-header {
  padding: 14px 16px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-800);
  cursor: pointer;
}

.flow-card-body {
  padding: 14px 16px;
  display: none;
}

.flow-card-body.open { display: block; }

.flow-step {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  align-items: flex-start;
}

.flow-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.flow-step-text { font-size: 13px; color: var(--gray-700); line-height: 1.6; }

.result-tag {
  display: inline-block;
  background: var(--danger-light);
  color: var(--danger);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  margin-top: 4px;
}

.result-tag.ok { background: var(--success-light); color: var(--success); }

/* ===== Current Sequence ===== */
.current-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 16px;
}

.current-table th {
  background: var(--gray-100);
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  color: var(--gray-600);
  border-bottom: 2px solid var(--gray-200);
  font-size: 12px;
}

.current-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: top;
}

.current-table tr:last-child td { border-bottom: none; }

.current-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

/* 電流ボタン専用レイアウト */
.curr-btn {
  align-items: center;
}
.curr-btn-body {
  flex: 1;
  min-width: 0;
}
.curr-btn-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 3px;
}
.curr-btn-value {
  font-weight: 700;
  font-size: 14px;
  color: var(--gray-800);
  white-space: nowrap;
}
.curr-btn-desc {
  font-size: 11px;
  color: var(--gray-400);
  line-height: 1.4;
}

.curr-0a { background: #fee2e2; color: #991b1b; font-size:11px; padding:2px 8px; border-radius:4px; font-weight:700; }
.curr-01 { background: #fef3c7; color: #92400e; font-size:11px; padding:2px 8px; border-radius:4px; font-weight:700; }
.curr-05 { background: #dbeafe; color: #1d4ed8; font-size:11px; padding:2px 8px; border-radius:4px; font-weight:700; }
.curr-1a { background: #d1fae5; color: #065f46; font-size:11px; padding:2px 8px; border-radius:4px; font-weight:700; }
.curr-board { background: #fde8e8; color: #9b1c1c; border: 1px solid #fca5a5; font-size:11px; padding:2px 8px; border-radius:4px; font-weight:700; }

/* ===== History ===== */
.history-item {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
}

.history-item:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.history-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.history-info { flex: 1; min-width: 0; }
.history-date { font-size: 11px; color: var(--gray-400); margin-bottom: 2px; }
.history-model { font-size: 14px; font-weight: 700; color: var(--gray-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-meta { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

.history-result {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}

.res-ok { background: var(--success-light); color: var(--success); }
.res-partial { background: var(--warning-light); color: var(--warning); }
.res-ng { background: var(--danger-light); color: var(--danger); }
.res-pending { background: var(--gray-100); color: var(--gray-500); }

/* ===== History Detail ===== */
.detail-row {
  display: flex;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 14px;
  gap: 12px;
}

.detail-row:last-child { border-bottom: none; }

.detail-label {
  color: var(--gray-500);
  min-width: 110px;
  flex-shrink: 0;
  font-size: 13px;
}

.detail-value {
  color: var(--gray-800);
  font-weight: 500;
  flex: 1;
}

/* ===== Textarea / Input ===== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-600);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--gray-800);
  background: white;
  transition: border-color 0.2s;
  font-family: inherit;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

textarea.form-input {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

/* ===== Score Display ===== */
.score-bar-wrap {
  margin-bottom: 10px;
}

.score-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
}

.score-bar {
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.fill-blue { background: linear-gradient(90deg, #3b82f6, #1d4ed8); }
.fill-green { background: linear-gradient(90deg, #10b981, #059669); }
.fill-yellow { background: linear-gradient(90deg, #f59e0b, #d97706); }
.fill-red { background: linear-gradient(90deg, #f87171, #dc2626); }

/* ===== 原因可能性内訳 (cause-row) ===== */
.cause-row {
  background: white;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
}

.cause-row-top {
  border-color: var(--primary);
  background: var(--primary-light);
}

.cause-row-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.cause-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--gray-300);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}
.cause-row-top .cause-rank { background: #fbbf24; }

.cause-label-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.cause-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-800);
}

.cause-repair-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
}
.tag-ok  { background: #d1fae5; color: #065f46; }
.tag-ng  { background: #fee2e2; color: #991b1b; }

.cause-confirmed {
  font-size: 11px;
  font-weight: 700;
  color: #059669;
}

/* パーセント表示 */
.cause-pct {
  font-size: 20px;
  font-weight: 800;
  flex-shrink: 0;
  min-width: 52px;
  text-align: right;
  line-height: 1;
}
.pct-high { color: #dc2626; }
.pct-mid  { color: #d97706; }
.pct-low  { color: var(--gray-500); }

/* バー */
.cause-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cause-bar {
  flex: 1;
  height: 10px;
  background: var(--gray-200);
  border-radius: 5px;
  overflow: hidden;
}

.cause-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.cause-score-note {
  font-size: 11px;
  color: var(--gray-400);
  flex-shrink: 0;
  min-width: 32px;
  text-align: right;
}

/* ===== 買い替えアドバイス ===== */
.replace-advice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #fffbeb;
  border: 2px solid #fcd34d;
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 12px;
}

.replace-advice-icon { font-size: 26px; flex-shrink: 0; }

.replace-advice-title {
  font-size: 13px;
  font-weight: 800;
  color: #92400e;
  margin-bottom: 5px;
}

.replace-advice-text {
  font-size: 12px;
  color: #78350f;
  line-height: 1.6;
}

/* ===== Tabs ===== */
.tab-bar {
  display: flex;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 16px;
  background: white;
  sticky: top;
}

.tab-btn {
  flex: 1;
  padding: 12px 8px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--gray-400);
}

.empty-state i { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 14px; }

/* ===== Divider ===== */
.divider {
  height: 8px;
  background: var(--gray-100);
  margin: 16px 0;
  border-top: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
}

/* ===== Floating Save Button ===== */
.fab-save {
  position: fixed;
  bottom: 24px;
  right: 20px;
  background: linear-gradient(135deg, #057a55 0%, #046c4e 100%);
  color: white;
  border: none;
  padding: 14px 20px;
  border-radius: 28px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(5,122,85,0.4);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 200;
  transition: all 0.2s;
}

.fab-save:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(5,122,85,0.45); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  display: none;
}

.modal-overlay.open { display: flex; }

.modal-sheet {
  background: white;
  border-radius: 20px 20px 0 0;
  padding: 20px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--gray-300);
  border-radius: 2px;
  margin: 0 auto 20px;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--gray-800);
  margin-bottom: 16px;
  text-align: center;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--gray-800);
  color: white;
  padding: 12px 20px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  z-index: 400;
  opacity: 0;
  transition: all 0.3s;
  white-space: nowrap;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Chip ===== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.chip-blue { background: #dbeafe; color: #1d4ed8; }
.chip-green { background: #d1fae5; color: #065f46; }
.chip-red { background: #fee2e2; color: #991b1b; }
.chip-gray { background: var(--gray-100); color: var(--gray-600); }

/* ===== Progress summary in checklist ===== */
.check-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

.check-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
}

.check-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.check-progress-text {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-600);
  min-width: 40px;
  text-align: right;
}

/* ===== Animation ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeInUp 0.3s ease forwards; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 2px; }
