/* ==========================================================================
   JichiLog モックアップ共通スタイル
   KaigoLog 版をベースに JichiLog Accent（テラコッタ #C96A3C）に差し替え
   ブランド方針 02_共通ブランド方針.md §製品別 Accent 準拠
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }

:root {
  --primary:       #1c3464;
  --primary-dark:  #14254a;
  --primary-light: #e3eaf5;
  /* JichiLog Accent: テラコッタ（地域・温かみ） */
  --accent:        #C96A3C;
  --accent-light:  #f7e8df;
  --accent-hover:  #a8572e;

  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;

  --safe-color:       #047857; /* 無事=緑系 */
  --safe-bg:          #d1fae5;
  --needs-help-color: #b91c1c; /* たすけてほしい=赤系（命に関わる緊急色） */
  --needs-help-bg:    #fee2e2;

  --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;
}

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;
  font-size: 16px;
  letter-spacing: 0.04em;
  -webkit-font-smoothing: antialiased;
}

p, li, .notice-meta { font-size: 14px; }
/* 最小文字サイズ底上げ：補足テキストを13px以上に保つ */
.notice-meta { font-size: 14px; }

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 16px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.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;
}
.brand-name  { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.brand-tag   { font-size: 12px; color: var(--text-tertiary); margin-top: 1px; }

/* ナビ */
.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: 12px; 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; }
.page-subtitle { font-size: 12.5px; color: var(--text-secondary); margin: 4px 0 0; }

/* ボタン */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; min-height: 44px;
  border-radius: 4px; border: 1px solid transparent;
  font-size: 13px; font-weight: 600;
  transition: background .12s, border-color .12s;
  text-decoration: none; letter-spacing: .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: var(--accent-hover); text-decoration: none; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #9b1616; text-decoration: none; color: #fff; }
.btn-sm  { padding: 5px 10px; font-size: 12px; min-height: 44px; }
.btn-lg  { padding: 10px 20px; font-size: 14px; }
.btn-xl  { padding: 14px 28px; font-size: 16px; font-weight: 700; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* カード */
.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); }

/* バッジ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 3px;
  font-size: 12px; font-weight: 600; letter-spacing: .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: #e8d0c0; }
.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; }
.badge-admin    { background: #ede9fe; color: #5b21b6; border-color: #c4b5fd; }
.badge-manager  { background: #e0f2fe; color: #075985; border-color: #bae6fd; }

/* 入力 */
.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; }
.field { margin-bottom: 16px; }

/* グリッド */
.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: 14px; color: var(--text-secondary); font-weight: 600; margin-bottom: 6px; }
.stat-value { font-size: 24px; font-weight: 600; color: var(--text-primary); line-height: 1.2; }
.stat-sub   { font-size: 14px; color: var(--text-tertiary); margin-top: 3px; }

/* セクション見出し */
.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; color: var(--text-primary);
}

/* 安否専用 */
.safe-badge    { display:inline-block;padding:4px 10px;border-radius:4px;background:var(--safe-bg);color:var(--safe-color);font-weight:700;font-size:13px; }
.needs-badge   { display:inline-block;padding:4px 10px;border-radius:4px;background:var(--needs-help-bg);color:var(--needs-help-color);font-weight:700;font-size:13px; }
.no-resp-badge { display:inline-block;padding:4px 10px;border-radius:4px;background:#f3f4f6;color:#374151;font-weight:700;font-size:13px; }

/* 安心バッジ（D-1 常設） */
.safety-pledge {
  display: flex; align-items: flex-start; gap: 10px;
  background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: 8px; padding: 12px 16px;
  font-size: 13px; color: #166534; line-height: 1.6;
  margin-bottom: 16px;
}
.safety-pledge-icon { font-size: 20px; flex-shrink: 0; }

/* 専用「安否確認を発信」大ボタン */
.dispatch-btn {
  display: block; width: 100%;
  background: var(--accent); color: #fff;
  border: none; border-radius: 8px;
  padding: 18px 24px; font-size: 18px; font-weight: 700;
  text-align: center; cursor: pointer; letter-spacing: .04em;
  box-shadow: 0 4px 12px rgba(201,106,60,.3);
  transition: background .15s;
}
.dispatch-btn:hover { background: var(--accent-hover); }
.dispatch-btn:disabled { opacity: .6; cursor: not-allowed; }

/* 確認ダイアログ共通 */
.confirm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 2000; display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.confirm-box {
  background: #fff; border-radius: 12px; padding: 32px;
  max-width: 440px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
.confirm-title { font-size: 17px; font-weight: 700; margin: 0 0 12px; }
.confirm-msg   { font-size: 13.5px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 20px; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ツリー（D-2） */
.tree-node {
  margin-left: 20px; padding: 4px 0;
}
.tree-node-root { margin-left: 0; }
.tree-label {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 4px; cursor: pointer;
  font-size: 13.5px; color: var(--text-primary);
}
.tree-label:hover { background: var(--bg-hover); }
.tree-label.selected { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.tree-badge {
  font-size: 12px; font-weight: 600;
  padding: 1px 5px; border-radius: 3px;
}
.tree-badge-kai  { background: #ede9fe; color: #5b21b6; }
.tree-badge-han  { background: #dbeafe; color: #075985; }
.tree-badge-kumi { background: #d1fae5; color: #065f46; }

/* テーブル */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { background: var(--bg-subtle); padding: 9px 12px; text-align: left; font-size: 12px; color: var(--text-secondary); font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }

/* モバイル */
.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,.08);
}
.mobile-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(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 .3s ease;
    z-index: 999; box-shadow: 4px 0 16px rgba(0,0,0,.1);
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu-btn { display: inline-flex; }
  .main { padding: 56px 16px 32px; }
  button,.nav-item { min-height: 44px; }
  input[type="text"],input[type="email"],input[type="password"],textarea,select {
    font-size: 16px !important; min-height: 44px;
  }
  .page-title { font-size: 19px; }
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #jichi-role-switcher { display: none !important; }

  /* ステータスタブ横スクロール */
  [style*="margin-bottom: -1px"], [style*="margin-bottom:-1px"] {
    display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap; padding-bottom: 0;
  }

  /* btn-sm モバイル文字拡大 */
  .btn-sm { font-size: 13px; padding: 7px 12px; }

  /* トーストをモバイル下部フルバナー化 */
  .jl-toast {
    left: 12px !important; right: 12px !important;
    max-width: none !important;
    top: auto !important; bottom: 16px !important;
    font-size: 15px !important;
  }
}

/* ユーティリティ */
.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: 12px; }
.text-secondary { color: var(--text-secondary); }
.text-tertiary  { color: var(--text-tertiary); }
.fw-600  { font-weight: 600; }
.fw-700  { font-weight: 700; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

/* 進行中安否確認カード（02_dashboard） */
.campaign-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--bg-card);
}
.campaign-card:last-child { margin-bottom: 0; }
.campaign-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.campaign-card-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.campaign-card-btn {
  display: block;
  width: 100%;
  text-align: center;
  min-height: 44px;
  line-height: 44px;
  padding: 0;
  font-size: 15px;
  font-weight: 600;
}
/* PC幅ではカード内メタをインライン表示 */
@media (min-width: 768px) {
  .campaign-card-meta {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0 16px;
  }
}

/* アクセシビリティ */
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: .01ms !important;
    transition-duration: .01ms !important;
  }
}
