/* ============================================================
   NEVA iPhone版 - スタイルシート (Phase 5: 登録フォーム対応)
   MASTER SPEC v1.1 準拠 / 白基調モダンUI / 外部通信ゼロ
   ============================================================ */

:root {
  /* カラーパレット（白基調・青系アクセント） */
  --bg-app: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F1F5F9;
  --bg-subtle: #F1F5F9;
  --border-light: #E2E8F0;
  --border-subtle: #EDF2F7;

  /* テキストカラー */
  --text-main: #0F172A;
  --text-sub: #475569;
  --text-muted: #94A3B8;

  /* アクセントカラー */
  --accent-blue: #2563EB;
  --accent-blue-hover: #1D4ED8;
  --accent-blue-bg: #EFF6FF;
  --accent-blue-border: #BFDBFE;

  /* 角丸とシャドウ */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 2px 6px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-fab: 0 8px 20px rgba(37, 99, 235, 0.35);

  /* システム標準フォント（外部フォント不使用） */
  --font-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* リセット & タップ最適化 */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 画面切り替え制御 */
.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
}

.screen.hidden {
  display: none !important;
}

/* アプリ全体コンテナ（iPhone画面幅・セーフエリア対応） */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background-color: var(--bg-app);
  position: relative;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ============================================================
   1. ホーム画面 ヘッダー
   ============================================================ */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}

.header-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--text-main);
  line-height: 1.2;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-sub);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.header-btn:active {
  background-color: var(--bg-subtle);
}

.header-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* ============================================================
   2. ホーム画面 メインコンテンツ
   ============================================================ */
.main-content {
  flex: 1;
  padding: 16px 16px 96px 16px; /* FABと下部ボタン用の余白 */
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 検索バー */
.search-container {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  fill: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 44px;
  padding: 0 16px 0 42px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 15px;
  color: var(--text-main);
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-blue-bg);
}

.search-input::placeholder {
  color: var(--text-muted);
}

/* タブ切替（登録済み / ごみ箱） */
.tab-switcher {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 2px;
  margin-top: 2px;
}

.tab-btn {
  padding: 8px 14px;
  background: transparent;
  border: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: color 0.15s ease;
}

.tab-btn.active {
  color: var(--accent-blue);
}

.tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--accent-blue);
  border-radius: 2px;
}

.tab-badge {
  display: inline-block;
  margin-left: 4px;
  font-size: 12px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background-color: var(--bg-subtle);
  color: var(--text-sub);
}

.tab-btn.active .tab-badge {
  background-color: var(--accent-blue-bg);
  color: var(--accent-blue);
}

/* ============================================================
   3. サービス一覧カード（ホーム画面）
   ============================================================ */
.services-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.service-card {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.service-card.is-expanded {
  border-color: var(--accent-blue-border);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.service-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  background-color: var(--bg-card);
  transition: background-color 0.15s ease;
}

.service-card-header:active {
  background-color: var(--bg-card-hover);
}

.service-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.service-card-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: 8px;
}

.btn-toggle-accordion {
  padding: 6px 14px;
  background-color: var(--accent-blue-bg);
  color: var(--accent-blue);
  border: 1px solid var(--accent-blue-border);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.service-card.is-expanded .btn-toggle-accordion {
  background-color: var(--bg-subtle);
  color: var(--text-sub);
  border-color: var(--border-light);
}

.btn-toggle-accordion:active {
  opacity: 0.8;
}

.service-icon-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--accent-blue-bg);
  color: var(--accent-blue);
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.service-icon-box svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* 空状態 (0件時) */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  text-align: center;
  gap: 8px;
  background-color: var(--bg-card);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-lg);
  margin-top: 4px;
}

.empty-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--accent-blue-bg);
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}

.empty-icon-box svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.empty-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.empty-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.service-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.service-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.service-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-sub);
}

.count-badge {
  background-color: var(--accent-blue-bg);
  color: var(--accent-blue);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--radius-full);
}

.updated-text {
  color: var(--text-muted);
  font-size: 12px;
}

.service-arrow {
  color: var(--text-muted);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: currentColor;
}

/* ============================================================
   4. 下部アクション & フローティングボタン
   ============================================================ */
.bottom-actions {
  margin-top: 10px;
  display: flex;
  justify-content: center;
}

.btn-lock-now {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 320px;
  height: 44px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  color: var(--text-sub);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s ease;
}

.btn-lock-now:active {
  background-color: var(--bg-subtle);
}

.btn-lock-now svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.fab-add {
  position: fixed;
  right: 20px;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-blue-hover) 100%);
  color: #FFFFFF;
  border: none;
  box-shadow: var(--shadow-fab);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 30;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.fab-add:active {
  transform: scale(0.92);
}

.fab-add svg {
  width: 28px;
  height: 28px;
  fill: #FFFFFF;
}

/* ============================================================
   5. サブ画面共通ヘッダー (8分類 & サービス選択 & 登録フォーム)
   ============================================================ */
.sub-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 20;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--accent-blue);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s ease;
}

.btn-back:active {
  background-color: var(--accent-blue-bg);
}

.btn-back svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.sub-header-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-right: 48px; /* 戻るボタンとのバランス用 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   6. 8分類画面 (Phase 3: 「何を保存しますか？」)
   ============================================================ */
.screen-categories {
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

.categories-content {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.categories-intro {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.categories-main-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.categories-sub-desc {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-sub);
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 4px;
}

.category-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.1s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.category-card:active {
  background-color: var(--bg-card-hover);
  border-color: var(--accent-blue-border);
  transform: scale(0.98);
}

.category-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.category-icon-box {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background-color: var(--accent-blue-bg);
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
}

.category-icon-box svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.category-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.category-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.category-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.category-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ============================================================
   7. サービス選択画面 (Phase 4: サービス一覧)
   ============================================================ */
.screen-services {
  padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
}

.services-select-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.services-select-intro {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-sub);
  margin-bottom: 2px;
}

.services-select-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.service-select-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.service-select-item:active {
  background-color: var(--bg-card-hover);
  transform: scale(0.99);
}

.service-select-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.service-select-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background-color: var(--accent-blue-bg);
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.service-select-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.service-select-icon.icon-other {
  background-color: var(--bg-subtle);
  color: var(--text-muted);
}

.service-select-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.service-select-arrow {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  fill: currentColor;
  flex-shrink: 0;
}

.empty-text {
  padding: 30px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ============================================================
   8. 登録フォーム画面 (Phase 5: 入力画面)
   ============================================================ */
.screen-record-form {
  padding-bottom: calc(48px + env(safe-area-inset-bottom, 0px));
}

.record-form-content {
  padding: 18px 16px;
}

.record-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 6px;
}

.label-optional {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.label-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background-color: var(--accent-blue-bg);
  color: var(--accent-blue);
}

.form-static-value {
  padding: 12px 14px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.form-input, .form-textarea {
  width: 100%;
  padding: 12px 14px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 16px; /* iOS Safariの自動ズーム防止 (16px以上) */
  font-family: var(--font-base);
  color: var(--text-main);
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus, .form-textarea:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-blue-bg);
}

.form-input::placeholder, .form-textarea::placeholder {
  color: var(--text-muted);
  font-size: 14px;
}

.form-textarea {
  resize: vertical;
  line-height: 1.5;
}

/* パスワード入力（表示切替ボタン付き） */
.input-password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-password-wrapper .form-input {
  padding-right: 46px;
}

.btn-toggle-password {
  position: absolute;
  right: 6px;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
}

.btn-toggle-password.active {
  color: var(--accent-blue);
}

.btn-toggle-password svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* 自由項目セクション */
.custom-fields-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.custom-fields-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.custom-fields-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-sub);
}

.btn-add-custom-field {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 1px dashed var(--accent-blue);
  border-radius: var(--radius-sm);
  color: var(--accent-blue);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn-add-custom-field:active {
  background-color: var(--accent-blue-bg);
}

.custom-fields-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.custom-field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-card);
  padding: 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.custom-field-inputs {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.custom-label-input {
  font-size: 14px;
  padding: 8px 10px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
}

.custom-value-input {
  font-size: 15px;
  padding: 8px 10px;
}

.btn-remove-custom {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

.btn-remove-custom:active {
  color: #EF4444;
}

.btn-remove-custom svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* 画像プレースホルダー */
.image-placeholder-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background-color: var(--bg-card);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-md);
}

.image-placeholder-icon {
  width: 22px;
  height: 22px;
  fill: var(--text-muted);
  flex-shrink: 0;
}

.image-placeholder-text {
  font-size: 12px;
  color: var(--text-muted);
}

/* 下部アクションボタン */
.form-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.btn-submit-record {
  width: 100%;
  height: 48px;
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-blue-hover) 100%);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
  transition: transform 0.1s ease, box-shadow 0.15s ease, background-color 0.2s ease;
}

.btn-submit-record:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-submit-record:disabled {
  opacity: 0.75;
  cursor: not-allowed;
  transform: none;
}

.btn-submit-record.saved {
  background: #10B981;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.25);
}

.btn-submit-record.error {
  background: #EF4444;
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.25);
}

.form-notice {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ============================================================
   8. アコーディオン展開コンテナ & コンパクトRecordカード (Phase 7)
   ============================================================ */
.service-accordion-content {
  border-top: 1px solid var(--border-subtle);
  background-color: var(--bg-app);
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.service-accordion-content.hidden {
  display: none !important;
}

.records-compact-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 個別Recordの横長コンパクトカード */
.record-compact-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.record-compact-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-blue);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-compact-fields {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.record-compact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  line-height: 1.3;
}

.compact-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 60px;
}

.compact-val-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: flex-end;
  min-width: 0;
}

.compact-val {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  word-break: break-all;
  text-align: right;
}

.field-pwd-masked {
  letter-spacing: 2px;
  font-weight: 700;
  color: var(--text-sub);
}

.field-pwd-plain {
  font-family: monospace;
  font-weight: 600;
  color: var(--accent-blue);
}

/* パスワード表示トグルボタン */
.btn-pwd-show {
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-light);
  color: var(--accent-blue);
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1.2;
  transition: background-color 0.15s ease;
}

.btn-pwd-show:active {
  background-color: var(--accent-blue-bg);
}

/* メモ行 */
.compact-row-note {
  align-items: flex-start;
  margin-top: 2px;
}

.compact-note-val {
  background-color: var(--bg-subtle);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-sub);
  white-space: pre-wrap;
  text-align: left;
  flex: 1;
  border: 1px solid var(--border-subtle);
}

/* Recordごとの操作ボタン（編集・消す：Phase 8で有効化） */
.record-compact-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-subtle);
}

.btn-rec-action {
  padding: 4px 11px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  line-height: 1.2;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn-rec-action:active {
  transform: scale(0.96);
}

.btn-rec-edit {
  background-color: var(--accent-blue-bg);
  color: var(--accent-blue);
  border-color: var(--accent-blue-border);
}

.btn-rec-edit:active {
  background-color: #DBEAFE;
}

.btn-rec-delete {
  background-color: #FEF2F2;
  color: #DC2626;
  border-color: #FECACA;
}

.btn-rec-delete:active {
  background-color: #FEE2E2;
}

/* コピーボタン (Phase 12) */
.btn-copy-field {
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-sub);
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1.2;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-copy-field:active {
  background-color: var(--bg-subtle);
}

.btn-copy-field.is-copied {
  background-color: #ECFDF5;
  color: #059669;
  border-color: #A7F3D0;
}

.compact-note-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
}

.btn-copy-note {
  margin-top: 4px;
}

/* ============================================================
   9. ごみ箱一覧 (Phase 10, 11)
   ============================================================ */
.trash-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.trash-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.trash-card-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.trash-service-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trash-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-blue);
}

.trash-date {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.trash-summary-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-sub);
  background-color: var(--bg-subtle);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}

.trash-summary-label {
  font-weight: 600;
  color: var(--text-muted);
}

.trash-summary-val {
  font-weight: 500;
  word-break: break-all;
}

.trash-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-subtle);
}

.btn-trash-action {
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  line-height: 1.2;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn-trash-action:active {
  transform: scale(0.96);
}

.btn-trash-restore {
  background-color: var(--accent-blue-bg);
  color: var(--accent-blue);
  border-color: var(--accent-blue-border);
}

.btn-trash-restore:active {
  background-color: #DBEAFE;
}

.btn-trash-delete {
  background-color: #FEF2F2;
  color: #DC2626;
  border-color: #FECACA;
}

.btn-trash-delete:active {
  background-color: #FEE2E2;
}

.empty-icon-trash {
  background-color: #F1F5F9;
  color: var(--text-muted);
}

/* ============================================================
   10. ロック画面 (Phase 15)
   ============================================================ */
.screen-lock {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(var(--safe-area-top) + 24px) 24px calc(var(--safe-area-bottom) + 24px);
  background-color: var(--bg-app);
}

.lock-container {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  margin: auto;
}

.lock-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.lock-logo-box {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  background-color: #FFFFFF;
}

.lock-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lock-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 14px;
  letter-spacing: -0.5px;
}

.lock-tagline {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 4px;
}

.lock-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.btn-lock-auth {
  width: 100%;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 700;
  border-radius: var(--radius-md);
  background-color: var(--accent-blue);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease, background-color 0.15s ease;
}

.btn-lock-auth:active {
  transform: scale(0.98);
  opacity: 0.9;
}

.btn-lock-auth:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-lock-svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex-shrink: 0;
}

.lock-guide-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
  text-align: center;
  line-height: 1.4;
}

.lock-error-msg {
  width: 100%;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #DC2626;
  background-color: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: var(--radius-sm);
  text-align: center;
  line-height: 1.4;
  box-sizing: border-box;
}

.btn-lock-restore-link {
  background: none;
  border: none;
  color: var(--accent-blue);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  padding: 6px 12px;
  margin-top: -4px;
}

/* ============================================================
   11. 設定・バックアップモーダル (Phase 27, 28, 29)
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.hidden {
  display: none !important;
}

.settings-sheet {
  width: 100%;
  max-width: 480px;
  background-color: var(--bg-card);
  border-radius: 20px 20px 0 0;
  padding: 20px 20px calc(var(--safe-area-bottom) + 24px);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUpSheet 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpSheet {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.settings-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.btn-close-settings {
  background: none;
  border: none;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
}

.settings-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-card {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.settings-card-desc {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.5;
}

.settings-card-desc strong {
  color: var(--accent-blue);
}

.text-note {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-action-primary {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  background-color: var(--accent-blue);
  color: #FFFFFF;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.btn-action-primary:active {
  opacity: 0.85;
}

.btn-action-secondary {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  background-color: #FFFFFF;
  color: var(--text-main);
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn-action-secondary:active {
  background-color: var(--bg-subtle);
}

.settings-msg {
  padding: 10px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  line-height: 1.4;
  text-align: center;
}

.settings-msg.success {
  background-color: #ECFDF5;
  color: #059669;
  border: 1px solid #A7F3D0;
}

.settings-msg.error {
  background-color: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FECACA;
}

/* ============================================================
   導入案内画面 (#screen-install-guide) - ブラウザ起動時表示
   ============================================================ */
.screen-guide {
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(180deg, #091026 0%, #030611 100%);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 32px 20px calc(env(safe-area-inset-bottom, 0px) + 24px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.guide-container {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

/* 上部ブランドロゴ */
.guide-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.guide-logo-box {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.guide-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.guide-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #FFFFFF;
  margin-top: 4px;
}

.guide-tagline {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: #94A3B8;
}

/* メイン見出し＆サブ見出し */
.guide-intro {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
}

.guide-main-heading {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.45;
  color: #FFFFFF;
  letter-spacing: -0.2px;
}

.guide-sub-heading {
  font-size: 14px;
  font-weight: 500;
  color: #94A3B8;
  line-height: 1.4;
}

/* 手順カードリスト */
.guide-steps {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}

.guide-step-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(45, 30, 72, 0.85); /* 紫系ステップカード背景 */
  border: 1px solid rgba(192, 132, 252, 0.22); /* 紫の繊細な枠線 */
  border-radius: 16px;
  padding: 14px 16px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), 0 0 16px rgba(147, 51, 234, 0.1);
}

/* 丸数字バッジ */
.step-num-badge {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #9333EA, #7E22CE); /* 紫系グラデーション */
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(147, 51, 234, 0.45);
}

/* 手順文言 */
.step-body {
  flex: 1;
}

.step-text {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: #FFFFFF;
}

/* 右側アイコン */
.step-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(168, 85, 247, 0.15); /* 紫系アイコン背景 */
  display: flex;
  align-items: center;
  justify-content: center;
}

.svg-step-icon {
  width: 22px;
  height: 22px;
  fill: #C084FC; /* 明るい紫の操作アイコン */
}

/* 下部注意文 */
.guide-footer {
  text-align: center;
  margin-top: 8px;
  padding-top: 4px;
}

.guide-note-text {
  font-size: 12px;
  color: #64748B;
  letter-spacing: 0.2px;
}

/* ============================================================
   Informationモーダル (#modal-info) & 赤系重要注意アラート
   ============================================================ */
.info-alert-danger {
  background-color: #FEF2F2;
  border: 1.5px solid #EF4444;
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.15);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-alert-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-alert-icon {
  width: 22px;
  height: 22px;
  fill: #DC2626;
  flex-shrink: 0;
}

.info-alert-title {
  font-size: 16px;
  font-weight: 800;
  color: #B91C1C;
  line-height: 1.2;
}

.info-alert-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.info-alert-text {
  font-size: 14px;
  font-weight: 700;
  color: #991B1B;
  line-height: 1.55;
}

.info-alert-subtext {
  font-size: 13px;
  font-weight: 600;
  color: #B91C1C;
  line-height: 1.45;
  padding: 6px 10px;
  background: rgba(254, 226, 226, 0.7);
  border-radius: var(--radius-sm);
  border-left: 3px solid #EF4444;
}





