/* ─── 設定ページ（フルページ） ─── */
.settings-page {
  max-width: 720px;
  margin: 0 auto;
}

.settings-page-header {
  margin-bottom: 32px;
}

.settings-page-header h2 {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

.settings-page-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ─── 設定セクション ─── */
.settings-section {
  margin-bottom: 32px;
}

.settings-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  padding-left: 4px;
}

.settings-section-title .icon {
  font-size: 20px;
  color: var(--primary);
}

/* ─── 設定カード ─── */
.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.25s ease;
}

.settings-card:hover {
  box-shadow: var(--shadow);
}

/* ─── 設定行 ─── */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s ease;
}

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

.settings-row:hover {
  background: var(--surface);
}

.settings-row-info {
  flex: 1;
  min-width: 0;
}

.settings-row-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.settings-row-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.settings-inline-status {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.5;
}

.settings-inline-status[data-state="idle"] {
  color: var(--text-muted);
}

.settings-inline-status[data-state="working"] {
  color: var(--primary);
}

.settings-inline-status[data-state="ready"] {
  color: var(--success, #10b981);
}

.settings-inline-status[data-state="warn"] {
  color: var(--warning, #f59e0b);
}

.privacy-snapshot-card {
  padding: 22px;
}

.privacy-snapshot-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.privacy-snapshot-kicker {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(108, 99, 255, 0.1);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.privacy-snapshot-hero h3 {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text);
}

.privacy-snapshot-hero p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 54ch;
}

.privacy-snapshot-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 110px;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.privacy-snapshot-badge[data-state="ready"] {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success, #10b981);
}

.privacy-snapshot-badge[data-state="idle"] {
  background: rgba(15, 23, 42, 0.04);
}

.privacy-snapshot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.privacy-snapshot-item {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.privacy-snapshot-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.privacy-snapshot-item strong {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

.privacy-snapshot-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.privacy-snapshot-note {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid var(--border-light);
}

.privacy-snapshot-note .icon {
  color: var(--primary);
  font-size: 20px;
  margin-top: 2px;
}

.privacy-snapshot-note strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 3px;
}

.privacy-snapshot-note p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.settings-row-control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ─── チップグループ（ラジオ代替） ─── */
.chip-group {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border-radius: 10px;
  padding: 3px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.chip:hover {
  color: var(--text);
}

.chip input {
  display: none;
}

.chip.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* ─── トグルスイッチ ─── */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 26px;
  transition: all 0.3s ease;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  bottom: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--primary);
  box-shadow: 0 0 12px rgba(108,99,255,0.3);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* ─── 設定バッジ ─── */
.settings-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
}

/* ─── 小ボタン ─── */
.btn-sm {
  padding: 7px 14px !important;
  font-size: 12px !important;
  border-radius: 8px !important;
}

/* ─── アプリロックサブモーダル ─── */
.app-lock-submodal {
  max-width: 380px !important;
}

.app-lock-submodal h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

.security-modal-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  margin-bottom: 12px;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.security-modal-input:focus {
  border-color: var(--primary);
}

.app-lock-error {
  color: var(--danger, #e53935);
  font-size: 13px;
  margin-bottom: 8px;
}

/* ─── アプリロック画面（起動時パスワード） ─── */
.app-lock-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: overlayFadeIn 0.3s ease;
}

.app-lock-screen.fade-out {
  animation: overlayFadeOut 0.4s ease forwards;
}

@keyframes overlayFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.app-lock-box {
  text-align: center;
  max-width: 340px;
  width: 90%;
}

.app-lock-icon {
  margin-bottom: 16px;
  color: var(--primary);
}

.app-lock-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}

.app-lock-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.app-lock-input-wrap {
  margin-bottom: 12px;
}

.app-lock-input {
  width: 100%;
  padding: 14px 18px;
  font-size: 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text);
  outline: none;
  text-align: center;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

.app-lock-input:focus {
  border-color: var(--primary);
}

.app-lock-actions {
  margin-top: 8px;
}

/* ─── オフラインインジケーター ─── */
.offline-indicator {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.offline-indicator .icon {
  font-size: 14px;
}

/* ─── モバイル ─── */
@media (max-width: 768px) {
  .settings-page {
    max-width: none;
  }

  .privacy-snapshot-hero {
    flex-direction: column;
  }

  .privacy-snapshot-badge {
    width: 100%;
  }

  .privacy-snapshot-grid,
  .privacy-snapshot-notes {
    grid-template-columns: 1fr;
  }

  .settings-row-control .chip-group {
    width: 100%;
  }

  .settings-row-control .chip {
    flex: 1 1 auto;
    justify-content: center;
  }

  .settings-page-header h2 {
    font-size: 22px;
  }

  .settings-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
  }

  .settings-row-control {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .app-lock-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .app-lock-submodal,
  .panel-modal {
    width: 100%;
  }
}
