/* ==========================================================================
   KaigoLog モックアップ共通スタイル
   2026-05-22 v0.2 - フォーマル調整版
   ========================================================================== */

/* ----- リセット ----- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* ----- カラーパレット（落ち着いた professional 寄り） ----- */
:root {
  --primary: #1c3464;          /* AnpiLog と同系の深いネイビー */
  --primary-dark: #14254a;
  --primary-light: #e3eaf5;
  --accent: #b8741a;           /* 暖色だが抑えめのアンバー */
  --accent-light: #f6ecdb;

  color-scheme: light;
  --text-primary: #111827;
  --text-secondary: #374151;
  --text-tertiary: #6b7280;
  --text-muted: #9ca3af;
  --text-inverse: #ffffff;

  --bg-app: #f4f5f7;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-hover: #f3f4f6;
  --bg-subtle: #fafbfc;

  --border: #e2e5ea;
  --border-strong: #c9ced6;

  --success: #047857;
  --warning: #b45309;
  --danger: #b91c1c;
  --info: #1e40af;

  --radius-sm: 3px;
  --radius-md: 4px;
  --radius-lg: 6px;
  --radius-xl: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 2px 6px rgba(0,0,0,.06);
  --shadow-lg: 0 6px 16px rgba(0,0,0,.08);

  --sidebar-width: 232px;
  --header-height: 56px;
}

/* ----- 基本 ----- */
body {
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Yu Gothic Medium", "Yu Gothic", "Meiryo", sans-serif;
  color: var(--text-primary);
  background: var(--bg-app);
  line-height: 1.85;            /* 1.7 → 1.85 行間広げて呼吸感 */
  font-size: 15px;               /* 14 → 15 やや大きく */
  letter-spacing: 0.04em;        /* 0.01 → 0.04 字間広げて読みやすく */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* font-feature-settings: 'palt' を解除 → 標準の全角間隔（より広い）にする */
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; cursor: pointer; }

/* ----- レイアウト ----- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.main {
  padding: 24px 32px 40px;
  min-width: 0;
}

/* ----- ロゴ ----- */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 6px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}
.brand-mark {
  width: 36px; height: 36px;
  background: var(--primary);
  color: #fff;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 16px;
  font-family: Georgia, 'Times New Roman', serif;
  letter-spacing: -0.02em;
}
.brand-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}
.brand-tag {
  font-size: 10.5px;
  color: var(--text-tertiary);
  margin-top: 1px;
  letter-spacing: 0.02em;
}

/* ----- ナビ ----- */
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  line-height: 1.4;
}
.nav-item:hover { background: var(--bg-hover); text-decoration: none; color: var(--text-primary); }
.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.nav-icon {
  width: 18px; text-align: center;
  font-size: 14px;
  color: var(--text-tertiary);
}
.nav-item.active .nav-icon { color: var(--primary); }
.nav-section {
  font-size: 10.5px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 18px 12px 6px;
  font-weight: 600;
}

/* ----- ヘッダー ----- */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 16px;
}
.page-title {
  font-size: 21px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: 0.01em;
}
.page-subtitle {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: 4px 0 0;
}

/* ----- ボタン ----- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 4px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.12s, border-color 0.12s;
  text-decoration: none;
  letter-spacing: 0.02em;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--bg-hover); text-decoration: none; }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-hover); text-decoration: none; }
.btn-accent {
  background: var(--accent);
  color: #fff;
}
.btn-accent:hover { background: #98621a; text-decoration: none; color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 10px 20px; font-size: 14px; }

/* ----- カード ----- */
.card {
  background: var(--bg-card);
  border-radius: 6px;
  border: 1px solid var(--border);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-size: 13.5px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

/* ----- バッジ ----- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}
.badge-primary { background: var(--primary-light); color: var(--primary); border-color: #cdd8e8; }
.badge-accent { background: var(--accent-light); color: var(--accent); border-color: #e8d3b3; }
.badge-success { background: #d1fae5; color: var(--success); border-color: #a7f0c5; }
.badge-warning { background: #fef3c7; color: var(--warning); border-color: #fde68a; }
.badge-info { background: #dbeafe; color: var(--info); border-color: #bfdbfe; }
.badge-neutral { background: var(--bg-hover); color: var(--text-secondary); border-color: var(--border); }
.badge-danger { background: #fee2e2; color: var(--danger); border-color: #fecaca; }

/* ----- 入力 ----- */
.input, .textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text-primary);
  background: var(--bg-card);
  line-height: 1.5;
}
.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}
.textarea { resize: vertical; min-height: 80px; }
.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
  letter-spacing: 0.02em;
}

/* ----- 音声入力 関連（共通） ----- */
.voice-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.12s;
}
.voice-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.voice-btn.recording {
  background: #fee2e2;
  border-color: var(--danger);
  color: var(--danger);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(185, 28, 28, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(185, 28, 28, 0); }
}
.voice-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--danger);
  font-weight: 600;
}
.voice-indicator-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse 1.2s ease-in-out infinite;
}
.voice-waveform {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 14px;
}
.voice-waveform span {
  display: inline-block;
  width: 2px;
  background: var(--danger);
  border-radius: 1px;
  animation: wave 1s ease-in-out infinite;
}
.voice-waveform span:nth-child(1) { height: 30%; animation-delay: 0s; }
.voice-waveform span:nth-child(2) { height: 70%; animation-delay: 0.1s; }
.voice-waveform span:nth-child(3) { height: 100%; animation-delay: 0.2s; }
.voice-waveform span:nth-child(4) { height: 60%; animation-delay: 0.3s; }
.voice-waveform span:nth-child(5) { height: 90%; animation-delay: 0.4s; }
.voice-waveform span:nth-child(6) { height: 40%; animation-delay: 0.5s; }
.voice-waveform span:nth-child(7) { height: 80%; animation-delay: 0.6s; }
@keyframes wave {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1); }
}

/* ----- グリッド ----- */
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ----- 統計 ----- */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
}
.stat-label {
  font-size: 11.5px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.stat-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.stat-sub {
  font-size: 11.5px;
  color: var(--text-tertiary);
  margin-top: 3px;
}

/* ----- モバイル ----- */
@media (max-width: 768px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
  .sidebar.mobile-open {
    display: block;
    position: fixed;
    z-index: 100;
    width: 280px;
    box-shadow: var(--shadow-lg);
  }
  .main { padding: 16px; }
  .page-title { font-size: 19px; }
}

/* ----- モバイルヘッダー ----- */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
@media (max-width: 768px) {
  .mobile-header { display: flex; }
}
.menu-btn {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-primary);
}

/* ----- セクション見出し ----- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.section-header h2,
.section-header h3 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-primary);
  text-transform: none;
}

/* ----- ユーティリティ ----- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11px; }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.fw-700 { font-weight: 700; }


/* =============================================================
 * モバイル対応 (2026-05-27 追加)
 * - 768px 以下: サイドバー折りたたみ + ハンバーガーメニュー
 * - 44px 最小タップ領域（Apple HIG / Material Design 推奨）
 * - 横スクロール防止
 * - フォームの大型化（タッチ操作配慮）
 * ============================================================= */

html, body {
  overflow-x: hidden;  /* 横スクロール防止（モバイルでの誤レイアウト時の保険） */
}

/* ハンバーガーメニューボタン（モバイル時のみ表示） */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1000;
  width: 44px;
  height: 44px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 22px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* オーバーレイ（サイドバー開時のモバイル用） */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 998;
}
.mobile-overlay.active {
  display: block;
}

@media (max-width: 768px) {
  /* レイアウト全般 */
  .app {
    grid-template-columns: 1fr !important;
  }

  /* サイドバー: 左スライドイン */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 80%;
    max-width: 320px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 999;
    box-shadow: 4px 0 16px rgba(0,0,0,0.1);
  }
  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  /* メイン領域: ハンバーガーボタン分の余白確保 */
  .main {
    padding-top: 56px;
    padding-left: 16px;
    padding-right: 16px;
  }

  /* 最小タップ領域 44px */
  button,
  .nav-item,
  .pill,
  .cat-tab,
  a.btn,
  .tmpl-dl-btn,
  .send-btn,
  .oauth-btn {
    min-height: 44px;
    padding: 10px 14px;
  }

  /* フォーム入力: タッチ操作配慮 */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  textarea,
  select {
    font-size: 16px !important;  /* iOS Safari の auto-zoom 防止 */
    min-height: 44px;
    padding: 10px 14px;
  }

  textarea {
    min-height: 88px;
  }

  /* グリッドの2-3カラムを1カラムに */
  .grid-2,
  .grid-3,
  .tmpl-grid {
    grid-template-columns: 1fr !important;
  }

  /* 表のスクロール対応 */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* page-header の余白縮小 */
  .page-header h1, .page-title {
    font-size: 20px;
  }

  /* バッジ系: 折り返し許可 */
  .mockup-badges {
    flex-wrap: wrap;
  }
}

/* タブレットサイズ (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar {
    width: 200px;
  }
  .grid-3 {
    grid-template-columns: 1fr 1fr;
  }
}

/* タッチデバイス特有: hover を無効化 */
@media (hover: none) {
  .mockup-card:hover,
  .tmpl-card:hover,
  .news-card:hover,
  .source-card:hover {
    box-shadow: none;
    border-color: var(--border);
  }
}


/* =============================================================
 * ダークモード初期対応 (prefers-color-scheme)
 * Phase 1A 雛形: 簡易対応（背景・テキスト・カードのみ）
 * 本格的なダークモードは Phase 1B でデザイナーレビュー後
 * ============================================================= */
/* 2026-06-06: ダークモードは一旦無効化（Phase 1A の簡易対応では、白固定の面＝AI吹き出し等に
 * 薄い文字が乗り「白地×薄灰で読めない」不読が発生するため）。下記ルールは Phase 1B の
 * 正式対応（デザイナーレビュー）まで温存し、メディアクエリ条件で無効化している。 */
@media (prefers-color-scheme: dark) and (min-width: 100000px) {
  :root {
    /* テキスト色 */
    --text-primary: #e8eaed;
    --text-secondary: #bdc1c6;
    --text-tertiary: #9aa0a6;

    /* 背景色 */
    --bg-app: #1a1d23;
    --bg-hover: #292d36;
    --border: #3c4047;
  }

  body {
    background: var(--bg-app);
    color: var(--text-primary);
  }

  /* カード類 */
  .mockup-card,
  .tmpl-card,
  .news-card,
  .source-card,
  .capability-card,
  .stance-banner,
  .side-panel,
  .filter-bar,
  .login-card {
    background: #25282f !important;
    color: var(--text-primary);
  }

  /* 入力フィールド */
  input,
  textarea,
  select {
    background: #2c3038;
    color: var(--text-primary);
    border-color: #3c4047;
  }

  /* 凡例カードの色補正 */
  .capability-card.can {
    background: #1a2e1f !important;
    border-color: #2d5a3a !important;
  }
  .capability-card.cannot {
    background: #2e1a1a !important;
    border-color: #5a2d2d !important;
  }
}


/* スマホ: 右上のコンテキストバッジ（事業所/氏名/プラン）は画面を圧迫するため非表示。
 * デスクトップでは表示維持（2026-06-06）。 */
@media (max-width: 900px) {
  #sinq-context-badge { display: none !important; }
}

/* =============================================================
 * アクセシビリティ: フォーカス可視化 + reduced motion
 * ============================================================= */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
.fw-600 { font-weight: 600; }
