/* SNS運用入稿管理システム - 統一CSS */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;700&display=swap');

:root {
  --primary: #1a237e;
  --primary-l: #283593;
  --accent: #1e88e5;
  --accent-l: #42a5f5;
  --accent-dark: #1565c0;
  --good: #c6efce;
  --good-t: #006100;
  --bad: #ffc7ce;
  --bad-t: #9c0006;
  --warn-bg: #fff9c4;
  --warn-t: #f57f17;
  --bg: #f0f2f5;
  --card: #fff;
  --border: #e0e0e0;
  --text: #333;
  --muted: #888;
  --sidebar-w: 240px;
  --topbar-h: 54px;

  /* SNSプラットフォームカラー */
  --instagram: #E4405F;
  --twitter: #000000;
  --tiktok: #00F2EA;
  --threads: #000000;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* =========================
   ログイン画面
========================= */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent-dark) 100%);
}

.login-card {
  background: var(--card);
  border-radius: 12px;
  padding: 48px 40px;
  width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-card h1 {
  text-align: center;
  color: var(--primary);
  font-size: 22px;
  margin-bottom: 8px;
}

.login-card .subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 32px;
}

.login-card .form-group {
  margin-bottom: 20px;
}

.login-card label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}

.login-card input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.login-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30,136,229,0.1);
}

.login-card .btn-login {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
}

.login-card .btn-login:hover {
  background: var(--accent-dark);
}

.login-card .error-msg {
  color: var(--bad-t);
  background: var(--bad);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

/* =========================
   アプリレイアウト
========================= */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* サイドバー */
.sidebar {
  width: var(--sidebar-w);
  background: var(--primary);
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.sidebar-brand .brand-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.sidebar-section {
  padding: 8px 20px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.35);
  margin-top: 8px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  text-decoration: none;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
  text-decoration: none;
}

.sidebar-nav a.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-left-color: var(--accent-l);
}

.sidebar-nav a .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 15px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}

/* メインエリア */
.main-area {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}

/* トップバー */
.topbar {
  height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-left h1 {
  font-size: 16px;
  font-weight: 600;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-right .user-info {
  font-size: 13px;
  color: var(--muted);
}

.topbar-right .btn-logout {
  padding: 6px 14px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.topbar-right .btn-logout:hover {
  border-color: var(--bad-t);
  color: var(--bad-t);
}

/* コンテンツエリア */
.content {
  padding: 24px;
}

/* =========================
   フィルターバー
========================= */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-bar select,
.filter-bar input {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: var(--card);
}

.filter-bar select:focus,
.filter-bar input:focus {
  outline: none;
  border-color: var(--accent);
}

.filter-bar .date-range {
  background: var(--bg);
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-spacer { flex: 1; }

/* =========================
   KPIカード
========================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--card);
  border-radius: 8px;
  padding: 16px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.kpi-card .kpi-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.kpi-card .kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}

.kpi-card .kpi-change {
  font-size: 12px;
  font-weight: 500;
  margin-left: 8px;
}

.kpi-change.up { color: var(--good-t); }
.kpi-change.down { color: var(--bad-t); }

/* =========================
   チャートカード
========================= */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--card);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.chart-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-card canvas {
  width: 100% !important;
}

/* 3列チャート */
.chart-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 1200px) {
  .chart-grid-3 { grid-template-columns: 1fr; }
}

/* =========================
   テーブル
========================= */
.data-table-wrap {
  background: var(--card);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  margin-bottom: 24px;
}

.data-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.data-table-header h3 {
  font-size: 14px;
  font-weight: 600;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
}

table.data-table th {
  background: #fafafa;
  padding: 10px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.data-table td {
  padding: 10px 16px;
  font-size: 13px;
  border-bottom: 1px solid #f0f0f0;
}

table.data-table tr:hover {
  background: #fafafa;
}

table.data-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* =========================
   ボタン
========================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); }

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); }

.btn-danger {
  background: var(--bad);
  color: var(--bad-t);
}
.btn-danger:hover { opacity: 0.8; }

.btn-sm { padding: 5px 10px; font-size: 12px; }

.source-tab { font-size: 12px; padding: 8px 6px; transition: all 0.2s; }
.source-tab.active { background: var(--accent) !important; color: #fff !important; }

/* =========================
   バッジ
========================= */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.badge-instagram { background: #fce4ec; color: var(--instagram); }
.badge-twitter { background: #e0e0e0; color: var(--twitter); }
.badge-tiktok { background: #e0f7fa; color: #00897b; }
.badge-threads { background: #f3e5f5; color: #6a1b9a; }
.badge-active { background: var(--good); color: var(--good-t); }
.badge-paused { background: var(--warn-bg); color: var(--warn-t); }
.badge-disconnected { background: var(--bad); color: var(--bad-t); }

.badge-draft { background: #e0e0e0; color: #616161; }
.badge-review { background: #fff3e0; color: #e65100; }
.badge-approved { background: #e8f5e9; color: #2e7d32; }
.badge-scheduled { background: #e3f2fd; color: #1565c0; }
.badge-published { background: var(--good); color: var(--good-t); }
.badge-failed { background: var(--bad); color: var(--bad-t); }

/* =========================
   モーダル
========================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--card);
  border-radius: 12px;
  width: 520px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 16px; }

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* =========================
   フォーム
========================= */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30,136,229,0.1);
}

/* =========================
   タブ
========================= */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* =========================
   トースト通知
========================= */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--card);
  border-radius: 8px;
  padding: 12px 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.3s ease;
  min-width: 280px;
}

.toast.success { border-left: 4px solid var(--good-t); }
.toast.error { border-left: 4px solid var(--bad-t); }
.toast.info { border-left: 4px solid var(--accent); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* =========================
   空状態
========================= */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state p {
  font-size: 14px;
}

/* =========================
   ローディング
========================= */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
}

/* =========================
   3階層フィルター
========================= */
.hierarchy-filter {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.hierarchy-filter .filter-group {
  flex: 1;
  min-width: 180px;
}

.hierarchy-filter .filter-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hierarchy-filter .form-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: var(--card);
}

.hierarchy-filter .form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30,136,229,0.1);
}

/* =========================
   追加バッジ
========================= */
.badge-youtube { background: #ffebee; color: #d32f2f; }
.badge-publishing { background: #fff3e0; color: #ef6c00; }
.badge-generating { background: #e3f2fd; color: #1565c0; }
.badge-completed { background: var(--good); color: var(--good-t); }
.badge-inactive { background: #eeeeee; color: #616161; }

/* ロールバッジ */
.badge-admin { background: #ede7f6; color: #4527a0; }
.badge-editor { background: #e3f2fd; color: #1565c0; }
.badge-viewer { background: #f3e5f5; color: #7b1fa2; }

/* センチメントバッジ */
.badge-positive { background: #e8f5e9; color: #2e7d32; }
.badge-neutral { background: #f5f5f5; color: #616161; }
.badge-negative { background: #ffebee; color: #c62828; }

/* 投稿タイプバッジ */
.badge-feed { background: #e3f2fd; color: #1565c0; }
.badge-story { background: #fce4ec; color: #c2185b; }
.badge-reel { background: #f3e5f5; color: #7b1fa2; }
.badge-carousel { background: #e8f5e9; color: #2e7d32; }
.badge-thread { background: #e0e0e0; color: #424242; }
.badge-short { background: #ffebee; color: #d32f2f; }

/* セベリティバッジ */
.badge-low { background: #e8f5e9; color: #2e7d32; }
.badge-medium { background: #fff3e0; color: #ef6c00; }
.badge-high { background: #ffebee; color: #c62828; }
.badge-critical { background: #d32f2f; color: #fff; }

/* =========================
   パンくずリスト
========================= */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}

.breadcrumb a {
  color: var(--accent);
}

.breadcrumb .separator {
  color: var(--border);
}

/* =========================
   カードレイアウト
========================= */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: var(--card);
  border-radius: 8px;
  padding: 16px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-body {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}

.card-meta {
  font-size: 12px;
  color: var(--muted);
}

/* =========================
   メディアグリッド
========================= */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.media-item {
  background: var(--card);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: transform 0.2s;
  cursor: pointer;
}

.media-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.media-item .media-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: #f0f0f0;
}

.media-item .media-video-icon {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
  font-size: 32px;
  color: var(--muted);
}

.media-item .media-info {
  padding: 8px 10px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================
   ドロップゾーン
========================= */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 20px;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(30,136,229,0.04);
  color: var(--accent);
}

.dropzone .dropzone-icon {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.dropzone p {
  font-size: 13px;
}

/* =========================
   タイムライン（承認履歴等）
========================= */
.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--card);
}

.timeline-item.action-approve::before { background: var(--good-t); }
.timeline-item.action-reject::before { background: var(--bad-t); }
.timeline-item.action-submit::before { background: var(--accent); }

.timeline-item .timeline-date {
  font-size: 11px;
  color: var(--muted);
}

.timeline-item .timeline-action {
  font-size: 13px;
  font-weight: 500;
  margin: 2px 0;
}

.timeline-item .timeline-comment {
  font-size: 13px;
  color: var(--muted);
  background: var(--bg);
  padding: 8px 12px;
  border-radius: 6px;
  margin-top: 4px;
}

/* =========================
   モーダル改善（大モーダル用）
========================= */
.modal.modal-lg .modal-content,
.modal .modal-content.modal-lg {
  width: 800px;
  max-width: 90vw;
}

.modal .modal-content.modal-xl {
  width: 1000px;
  max-width: 95vw;
}

/* 新モーダルパターン（overlay内包型） */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.5);
}

.modal.show {
  display: flex;
}

.modal .modal-overlay {
  position: absolute;
  inset: 0;
}

.modal .modal-content {
  position: relative;
  background: var(--card);
  border-radius: 12px;
  width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  z-index: 1;
}

/* =========================
   ページネーション
========================= */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.pagination .btn {
  min-width: 80px;
  justify-content: center;
}

.pagination .page-info {
  font-size: 13px;
  color: var(--muted);
}

/* =========================
   チェックボックスリスト
========================= */
.checkbox-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
}

.checkbox-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
}

.checkbox-list label:hover {
  background: var(--bg);
}

.checkbox-list .group-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  padding: 8px 8px 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* =========================
   インラインフォーム（返信等）
========================= */
.inline-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.inline-form input,
.inline-form textarea {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}

/* =========================
   AIインサイト
========================= */

/* ヒートマップ */
.heatmap-grid {
  display: grid;
  grid-template-columns: 50px repeat(24, 1fr);
  gap: 2px;
  margin: 16px 0;
}
.heatmap-header {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  padding: 4px 0;
  font-weight: 600;
}
.heatmap-day {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}
.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  cursor: pointer;
  transition: transform 0.1s;
  position: relative;
  min-height: 24px;
}
.heatmap-cell:hover {
  transform: scale(1.2);
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* AIスコアゲージ */
.score-gauge {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.score-gauge-inner {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.score-value {
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
}
.score-grade {
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 4px;
}

/* リスクバッジ */
.risk-low { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.risk-medium { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; }
.risk-high { background: #fbe9e7; color: #bf360c; border: 1px solid #ffab91; }
.risk-critical { background: #fce4ec; color: #c62828; border: 1px solid #ef9a9a; }

/* ファクターカード */
.factor-card {
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
}
.factor-card .factor-label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.factor-card .factor-bar {
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
}
.factor-card .factor-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.5s ease;
}
.factor-card .factor-detail {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

/* トレンドカード */
.trend-card {
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.trend-card h4 {
  font-size: 14px;
  margin-bottom: 8px;
}
.momentum-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.momentum-rising { background: #e8f5e9; color: #2e7d32; }
.momentum-stable { background: #e3f2fd; color: #1565c0; }
.momentum-falling { background: #fbe9e7; color: #bf360c; }

/* ハッシュタグ競合度 */
.competition-high { background: #fce4ec; color: #c62828; }
.competition-medium { background: #fff3e0; color: #e65100; }
.competition-low { background: #e8f5e9; color: #2e7d32; }

/* チェック結果 */
.check-pass { color: #2e7d32; }
.check-warning { color: #e65100; }
.check-fail { color: #c62828; }

/* プラットフォームチェックボックス */
.pf-checks {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 8px 0 16px;
}
.pf-checks label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  cursor: pointer;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: all 0.15s;
}
.pf-checks label:has(input:checked) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.pf-checks input[type="checkbox"] {
  display: none;
}

/* PFキャプション結果 */
.pf-result-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
}
.pf-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #fafafa;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.pf-result-body {
  padding: 16px;
  border-top: 1px solid var(--border);
}
.pf-result-body pre {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
  margin: 0;
}

/* レコメンドセット */
.recommend-set {
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 8px;
}
.recommend-set.safe { background: #e8f5e9; }
.recommend-set.growth { background: #e3f2fd; }
.recommend-set.aggressive { background: #fff3e0; }
.recommend-set h5 {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}
.recommend-set .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.recommend-set .tag {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.7);
}

/* =========================
   レスポンシブ
========================= */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-area { margin-left: 0; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-grid { grid-template-columns: 1fr; }
  .chart-grid-3 { grid-template-columns: 1fr; }
  .hierarchy-filter { flex-direction: column; gap: 8px; }
  .card-grid { grid-template-columns: 1fr; }
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .modal .modal-content { width: 95vw !important; }
}
