/* ============================================================
   ZEAL Intelligence Hub — style.css  v3.0
   ============================================================ */

/* ---- CSS変数 ---- */
:root {
  --primary:       #1a3a5c;
  --primary-light: #2256a0;
  --accent:        #e84545;
  --accent2:       #f0a500;
  --bg-base:       #f0f4f8;
  --bg-card:       #ffffff;
  --bg-sidebar:    #0d1f35;
  --bg-topbar:     #ffffff;
  --text-primary:  #1a2740;
  --text-secondary:#4a5f78;
  --text-muted:    #8a9bb0;
  --border:        #dde4ed;
  --shadow-sm:     0 1px 4px rgba(26,58,92,.06);
  --shadow-md:     0 4px 16px rgba(26,58,92,.10);
  --shadow-lg:     0 8px 32px rgba(26,58,92,.14);
  --radius:        12px;
  --radius-sm:     8px;
  --sidebar-w:     240px;
  --topbar-h:      60px;

  /* カテゴリカラー */
  --cat-display:   #2256a0;
  --cat-ad:        #e84545;
  --cat-design:    #8b5cf6;
  --cat-tech:      #10b981;
  --cat-event:     #f59e0b;
  --cat-competitor:#ef4444;
}

/* ダークモード */
body.dark {
  --bg-base:       #0d1f35;
  --bg-card:       #162840;
  --bg-topbar:     #0a1828;
  --text-primary:  #e2eaf5;
  --text-secondary:#9ab0c8;
  --text-muted:    #5a7a9a;
  --border:        #1e3450;
  --shadow-sm:     0 1px 4px rgba(0,0,0,.3);
  --shadow-md:     0 4px 16px rgba(0,0,0,.35);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.4);
}

/* ---- リセット ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans JP', 'Inter', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background .3s, color .3s;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
img { max-width: 100%; display: block; }

/* ============================================================
   ローディング画面
   ============================================================ */
.loading-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(135deg, #0a1628, #0d1f35);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .5s, visibility .5s;
}
.loading-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loading-content { text-align: center; }
.loading-logo {
  font-family: 'Inter', sans-serif;
  font-weight: 800; font-size: 2.2rem;
  color: #fff; letter-spacing: 4px;
  margin-bottom: 8px;
}
.loading-logo .logo-z   { color: #f0a500; }
.loading-logo .logo-eal { color: #fff; }
.loading-logo .logo-ih  {
  display: block; font-size: .8rem; font-weight: 400;
  letter-spacing: 6px; color: rgba(255,255,255,.4);
  text-transform: uppercase; margin-top: 4px;
}
.loading-bar-wrap {
  width: 240px; height: 3px;
  background: rgba(255,255,255,.1);
  border-radius: 99px; margin: 24px auto 12px; overflow: hidden;
}
.loading-bar {
  height: 100%; width: 0; border-radius: 99px;
  background: linear-gradient(90deg, #2256a0, #f0a500);
  transition: width .4s ease;
}
.loading-status {
  font-size: .78rem; color: rgba(255,255,255,.4);
  letter-spacing: 1px;
}

/* ============================================================
   サイドバー
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column;
  z-index: 200;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  overflow-y: auto; overflow-x: hidden;
}
.sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-w))); }

.sidebar-header {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.sidebar-logo {
  font-family: 'Inter', sans-serif;
  font-weight: 800; font-size: 1.4rem;
  letter-spacing: 3px;
}
.sidebar-logo .logo-z   { color: #f0a500; }
.sidebar-logo .logo-eal { color: #fff; }
.sidebar-sub {
  font-size: .65rem; color: rgba(255,255,255,.35);
  letter-spacing: 2px; text-transform: uppercase;
  margin-top: 3px; display: block;
}

/* ナビゲーション */
.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-section-label {
  font-size: .62rem; color: rgba(255,255,255,.25);
  text-transform: uppercase; letter-spacing: 1.5px;
  padding: 8px 10px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: rgba(255,255,255,.55);
  font-size: .85rem; font-weight: 500;
  transition: all .18s;
  position: relative; margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.85); }
.nav-item.active {
  background: rgba(34,86,160,.35);
  color: #fff;
  box-shadow: inset 3px 0 0 #f0a500;
}
.nav-item i { width: 18px; text-align: center; font-size: .88rem; flex-shrink: 0; }
.nav-item span { flex: 1; }
.nav-badge {
  font-size: .6rem; font-weight: 700;
  background: var(--accent); color: #fff;
  padding: 2px 6px; border-radius: 99px;
  letter-spacing: .5px;
}
.nav-badge.bookmark-badge { background: #f59e0b; }

/* サイドバーフッター */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.user-info {
  display: flex; align-items: center; gap: 8px;
  color: rgba(255,255,255,.6); font-size: .8rem;
  margin-bottom: 10px;
}
.user-info i { font-size: 1.1rem; }
.btn-logout {
  width: 100%;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.55);
  padding: 8px; font-size: .78rem;
  transition: all .18s;
}
.btn-logout:hover { background: rgba(232,69,69,.2); color: #f87171; border-color: rgba(232,69,69,.3); }
.sidebar-version {
  font-size: .62rem; color: rgba(255,255,255,.2);
  text-align: center; margin-top: 8px;
}

/* ============================================================
   メインラッパー
   ============================================================ */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1; display: flex; flex-direction: column;
  min-height: 100vh;
  transition: margin-left .3s cubic-bezier(.4,0,.2,1);
}
.main-wrapper.expanded { margin-left: 0; }

/* ============================================================
   トップバー
   ============================================================ */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px; gap: 12px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
  transition: background .3s;
}
.topbar-left  { display: flex; align-items: center; gap: 10px; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.topbar-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: .95rem; position: relative;
  transition: all .18s;
}
.topbar-btn:hover { background: var(--bg-base); color: var(--primary); }

/* 検索 */
.search-wrap {
  display: flex; align-items: center;
  background: var(--bg-base); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px; gap: 8px;
  width: 280px; transition: all .2s;
}
.search-wrap:focus-within {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(34,86,160,.12);
  background: var(--bg-card);
}
.search-icon { color: var(--text-muted); font-size: .85rem; flex-shrink: 0; }
#globalSearch {
  border: none; background: transparent; outline: none;
  font-size: .85rem; color: var(--text-primary);
  font-family: inherit; flex: 1; padding: 8px 0;
}
#globalSearch::placeholder { color: var(--text-muted); }
.search-kbd {
  font-size: .62rem; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 5px; font-family: 'Inter', monospace;
  background: var(--bg-card); flex-shrink: 0;
}
.last-updated {
  font-size: .72rem; color: var(--text-muted);
  display: flex; align-items: center; gap: 5px;
  white-space: nowrap;
}
.last-updated i.spinning { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--accent); border-radius: 50%;
  border: 2px solid var(--bg-topbar);
}

/* ============================================================
   フィルター / 通知パネル
   ============================================================ */
.filter-panel, .notif-panel {
  position: fixed; top: var(--topbar-h); right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius) 0 0 var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 150; width: 300px;
  transform: translateX(110%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
.filter-panel.open, .notif-panel.open { transform: translateX(0); }

.filter-header, .notif-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: .85rem; font-weight: 700; color: var(--text-primary);
  gap: 8px;
}
.notif-header button {
  font-size: .72rem; color: var(--text-muted);
  background: none; border: 1px solid var(--border);
  border-radius: 6px; padding: 3px 8px;
  transition: all .18s;
}
.notif-header button:hover { color: var(--accent); border-color: var(--accent); }

.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 16px; }
.chip {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 99px;
  border: 1px solid var(--border);
  font-size: .75rem; font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer; transition: all .18s;
  user-select: none;
}
.chip input { display: none; }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip:hover { border-color: var(--primary-light); }

.notif-list { max-height: 400px; overflow-y: auto; padding: 8px 0; }
.notif-item {
  padding: 10px 16px; font-size: .8rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary); line-height: 1.5;
}
.notif-item:last-child { border-bottom: none; }
.notif-empty {
  padding: 24px 16px; text-align: center;
  font-size: .8rem; color: var(--text-muted);
}

/* ============================================================
   ビューコンテナ
   ============================================================ */
.view-container { flex: 1; padding: 28px 28px 40px; overflow-x: hidden; }

.view { display: none; animation: viewFadeIn .25s ease; }
.view.active { display: block; }
@keyframes viewFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.view-header { margin-bottom: 24px; }
.view-title   { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.view-subtitle{ font-size: .85rem; color: var(--text-muted); }

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.section-title {
  font-size: 1rem; font-weight: 700; color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}
.btn-see-all {
  font-size: .78rem; color: var(--primary-light);
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 5px 12px;
  display: flex; align-items: center; gap: 5px;
  transition: all .18s;
}
.btn-see-all:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ============================================================
   KPIカード
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 28px;
}
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform .18s, box-shadow .18s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.1rem; flex-shrink: 0;
}
.kpi-num  { font-size: 1.6rem; font-weight: 700; color: var(--text-primary); line-height: 1; }
.kpi-label{ font-size: .72rem; color: var(--text-muted); margin-top: 4px; }

/* ============================================================
   RSS ステータスグリッド
   ============================================================ */
.rss-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px; margin-bottom: 8px;
}
.rss-status-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-sm);
  font-size: .8rem;
}
.rss-status-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.rss-status-dot.ok      { background: #10b981; box-shadow: 0 0 6px #10b981; }
.rss-status-dot.loading { background: #f59e0b; animation: blink 1s infinite; }
.rss-status-dot.error   { background: #ef4444; }
@keyframes blink { 50% { opacity: .3; } }
.rss-status-name { font-weight: 600; color: var(--text-primary); flex: 1; }
.rss-status-count{ color: var(--text-muted); font-size: .72rem; }
.rss-status-loading {
  grid-column: 1/-1; text-align: center;
  padding: 16px; color: var(--text-muted); font-size: .85rem;
}

/* ============================================================
   信頼性バナー
   ============================================================ */
.trust-banner {
  display: flex; align-items: flex-start; gap: 12px;
  background: linear-gradient(135deg, rgba(16,185,129,.08), rgba(34,86,160,.05));
  border: 1px solid rgba(16,185,129,.25);
  border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 20px;
  font-size: .82rem; color: var(--text-secondary); line-height: 1.6;
}
.trust-banner i {
  color: #10b981; font-size: 1.1rem; flex-shrink: 0; margin-top: 2px;
}
.trust-banner strong { color: var(--text-primary); }

/* ============================================================
   ニュースカテゴリタブ
   ============================================================ */
.news-cat-tabs {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px;
}
.cat-tab {
  display: flex; align-items: center; gap: 5px;
  padding: 7px 16px; border-radius: 99px;
  font-size: .8rem; font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--bg-card);
  transition: all .18s;
}
.cat-tab:hover   { border-color: var(--primary-light); color: var(--primary); }
.cat-tab.active  { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ============================================================
   ニュースグリッド
   ============================================================ */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.news-loading, .empty-state {
  grid-column: 1/-1;
  text-align: center; padding: 48px 20px;
  color: var(--text-muted); font-size: .9rem;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px;
}
.news-loading i { font-size: 1.5rem; }

/* ニュースカード */
.news-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
  transition: transform .2s, box-shadow .2s;
  cursor: pointer;
}
.news-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.news-card-header {
  padding: 14px 14px 0;
  display: flex; align-items: center;
  justify-content: space-between; gap: 8px;
}
.cat-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .67rem; font-weight: 700;
  padding: 3px 8px; border-radius: 99px; color: #fff;
  text-transform: uppercase; letter-spacing: .5px;
}
.cat-badge.display    { background: var(--cat-display); }
.cat-badge.ad         { background: var(--cat-ad); }
.cat-badge.design     { background: var(--cat-design); }
.cat-badge.tech       { background: var(--cat-tech); }
.cat-badge.event      { background: var(--cat-event); }
.cat-badge.competitor { background: var(--cat-competitor); }

/* 信頼性バッジ */
.trust-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: .62rem; font-weight: 600;
  padding: 2px 7px; border-radius: 99px;
}
.trust-badge.rss {
  background: rgba(16,185,129,.12);
  color: #10b981; border: 1px solid rgba(16,185,129,.25);
}
.trust-badge.verified {
  background: rgba(34,86,160,.1);
  color: var(--primary-light); border: 1px solid rgba(34,86,160,.2);
}

.news-card-body { padding: 10px 14px 0; flex: 1; }
.news-card-title {
  font-size: .9rem; font-weight: 700;
  color: var(--text-primary); line-height: 1.45;
  margin-bottom: 7px;
  display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
}
.news-card-excerpt {
  font-size: .78rem; color: var(--text-secondary);
  line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}

.news-card-footer {
  padding: 10px 14px 14px;
  display: flex; align-items: center; gap: 8px;
  border-top: 1px solid var(--border); margin-top: 10px;
}
.news-card-source {
  font-size: .7rem; font-weight: 600;
  color: var(--primary-light); flex: 1;
  display: flex; align-items: center; gap: 4px;
}
.news-card-date { font-size: .7rem; color: var(--text-muted); }
.btn-bookmark {
  background: none; border: none;
  color: var(--text-muted); font-size: .85rem;
  padding: 2px 5px; transition: color .18s;
}
.btn-bookmark:hover   { color: #f59e0b; }
.btn-bookmark.saved   { color: #f59e0b; }
.btn-open {
  font-size: .68rem; color: var(--text-muted);
  background: var(--bg-base); border: 1px solid var(--border);
  border-radius: 6px; padding: 3px 8px;
  transition: all .18s; display: flex; align-items: center; gap: 3px;
}
.btn-open:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* さらに読み込む */
.load-more-wrap { text-align: center; margin-top: 28px; }
.btn-load-more {
  padding: 10px 28px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 99px; font-size: .85rem;
  color: var(--text-secondary);
  display: inline-flex; align-items: center; gap: 8px;
  transition: all .18s;
}
.btn-load-more:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ============================================================
   競合他社グリッド
   ============================================================ */
.competitor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.competitor-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s;
}
.competitor-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.competitor-card-header {
  display: flex; align-items: flex-start; gap: 12px;
  margin-bottom: 14px;
}
.competitor-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.1rem; flex-shrink: 0;
}
.competitor-name { font-size: .95rem; font-weight: 700; color: var(--text-primary); }
.competitor-category {
  font-size: .7rem; color: var(--text-muted);
  margin-top: 2px;
}
.competitor-tags {
  display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px;
}
.competitor-tag {
  font-size: .67rem; color: var(--primary-light);
  background: rgba(34,86,160,.08);
  border: 1px solid rgba(34,86,160,.15);
  border-radius: 4px; padding: 2px 7px;
}
.competitor-desc {
  font-size: .78rem; color: var(--text-secondary);
  line-height: 1.55; margin-bottom: 12px;
}
.competitor-footer {
  display: flex; align-items: center; gap: 8px;
}
.btn-competitor-link {
  font-size: .75rem; padding: 5px 12px;
  background: var(--primary); color: #fff;
  border: none; border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 5px;
  transition: background .18s;
}
.btn-competitor-link:hover { background: var(--primary-light); }
.competitor-news-count {
  font-size: .72rem; color: var(--text-muted);
  margin-left: auto; display: flex; align-items: center; gap: 4px;
}

/* ミニ競合グリッド（ダッシュボード） */
.competitor-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.competitor-mini-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  transition: transform .18s;
  cursor: pointer;
}
.competitor-mini-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.competitor-mini-name {
  font-size: .82rem; font-weight: 700;
  color: var(--text-primary); margin-bottom: 4px;
}
.competitor-mini-cat {
  font-size: .68rem; color: var(--text-muted);
}

/* ============================================================
   情報ソース
   ============================================================ */
.sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.source-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s;
}
.source-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.source-card-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 10px;
}
.source-icon {
  width: 38px; height: 38px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: #fff; flex-shrink: 0;
}
.source-name { font-size: .9rem; font-weight: 700; color: var(--text-primary); }
.source-url  { font-size: .7rem; color: var(--text-muted); margin-top: 1px; }
.source-desc {
  font-size: .78rem; color: var(--text-secondary);
  line-height: 1.55; margin-bottom: 10px;
}
.source-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.source-tag {
  font-size: .65rem; padding: 2px 7px;
  border-radius: 4px; border: 1px solid var(--border);
  color: var(--text-muted); background: var(--bg-base);
}
.source-footer {
  display: flex; align-items: center; justify-content: space-between;
}
.source-status {
  display: flex; align-items: center; gap: 5px;
  font-size: .72rem; font-weight: 600;
}
.source-status.active { color: #10b981; }
.source-status.error  { color: #ef4444; }
.source-status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.btn-source-open {
  font-size: .72rem; padding: 5px 12px;
  background: var(--bg-base); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-secondary);
  display: flex; align-items: center; gap: 4px;
  transition: all .18s;
}
.btn-source-open:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ============================================================
   モーダル
   ============================================================ */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; animation: modalBgIn .2s ease; }
@keyframes modalBgIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 640px; width: 100%;
  max-height: 85vh; overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: modalIn .25s cubic-bezier(.34,1.56,.64,1);
}
@keyframes modalIn { from { transform: scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 30px; height: 30px;
  border-radius: 50%; border: none;
  background: var(--bg-base); color: var(--text-muted);
  font-size: .85rem; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  transition: all .18s;
}
.modal-close:hover { background: var(--accent); color: #fff; }

.modal-body { padding: 28px; }
.modal-cat-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
}
.modal-title {
  font-size: 1.15rem; font-weight: 700;
  color: var(--text-primary); line-height: 1.4; margin-bottom: 10px;
}
.modal-meta {
  display: flex; align-items: center; gap: 12px;
  font-size: .75rem; color: var(--text-muted); margin-bottom: 16px;
  flex-wrap: wrap;
}
.modal-meta-item { display: flex; align-items: center; gap: 4px; }
.modal-excerpt {
  font-size: .87rem; color: var(--text-secondary);
  line-height: 1.7; margin-bottom: 20px;
  border-left: 3px solid var(--border);
  padding-left: 14px;
}
.modal-trust-note {
  background: rgba(16,185,129,.07);
  border: 1px solid rgba(16,185,129,.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: .78rem;
  color: var(--text-secondary); margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.modal-trust-note i { color: #10b981; flex-shrink: 0; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-modal-primary {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  background: var(--primary); color: #fff; border: none;
  font-size: .85rem; font-weight: 600;
  transition: background .18s;
}
.btn-modal-primary:hover { background: var(--primary-light); }
.btn-modal-secondary {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  background: var(--bg-base); color: var(--text-secondary);
  border: 1px solid var(--border); font-size: .85rem;
  transition: all .18s;
}
.btn-modal-secondary:hover { border-color: var(--primary-light); color: var(--primary); }
.btn-modal-secondary.bookmarked { color: #f59e0b; border-color: #f59e0b; }

/* ============================================================
   トースト通知
   ============================================================ */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1a2740; color: #e2eaf5;
  border-radius: 99px; padding: 10px 20px;
  font-size: .82rem; font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,.35);
  z-index: 9999; pointer-events: none;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .3s;
  opacity: 0; white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ============================================================
   エラーカード
   ============================================================ */
.error-card {
  background: rgba(239,68,68,.06);
  border: 1px solid rgba(239,68,68,.2);
  border-radius: var(--radius);
  padding: 16px 20px;
  font-size: .82rem; color: var(--text-secondary);
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.error-card i { color: #ef4444; font-size: 1rem; flex-shrink: 0; }

/* ============================================================
   レスポンシブ
   ============================================================ */
@media (max-width: 900px) {
  .news-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .view-container { padding: 18px 14px 32px; }
  .search-wrap { width: 160px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .competitor-grid { grid-template-columns: 1fr; }
  .news-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .topbar { padding: 0 12px; }
  .search-wrap { width: 120px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .search-kbd { display: none; }
}

/* ============================================================
   スクロールバー
   ============================================================ */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================
   翻訳・PRバッジ追加
   ============================================================ */
.trust-badge.translated {
  background: rgba(139,92,246,.1);
  color: #8b5cf6; border: 1px solid rgba(139,92,246,.25);
}
.trust-badge.en-pending {
  background: rgba(249,115,22,.08);
  color: #f97316; border: 1px solid rgba(249,115,22,.2);
}
.trust-badge.pr {
  background: rgba(0,105,192,.1);
  color: #0069c0; border: 1px solid rgba(0,105,192,.2);
}
.trust-badge.fallback {
  background: rgba(245,158,11,.1);
  color: #d97706; border: 1px solid rgba(245,158,11,.25);
}
.trust-badge.gnews {
  background: rgba(234,67,53,.1);
  color: #ea4335; border: 1px solid rgba(234,67,53,.25);
}

/* ============================================================
   ニュースフィード Google News UI
   ============================================================ */
.btn-gnews-feed {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  background: #ea4335;
  color: #fff;
  border: none;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s;
  flex-shrink: 0;
}
.btn-gnews-feed:hover    { background: #c62828; }
.btn-gnews-feed:disabled { opacity: .6; cursor: default; }

.gnews-fetch-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: rgba(234,67,53,.08);
  border: 1px solid rgba(234,67,53,.2);
  border-radius: var(--radius-sm);
  font-size: .82rem;
  color: #ea4335;
  margin-bottom: 14px;
}

.gnews-query-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.gnews-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 12px;
  border: 1.5px solid transparent;
  font-size: .72rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.gnews-chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 16px;
  border-radius: 8px;
  font-size: .62rem;
  font-weight: 700;
  padding: 0 4px;
}
.pr-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .67rem; font-weight: 700;
  padding: 2px 8px; border-radius: 4px;
  background: rgba(0,105,192,.1); color: #0069c0;
  border: 1px solid rgba(0,105,192,.2);
  margin-top: 6px;
}
.en-label {
  display: inline-block; font-size: .6rem; font-weight: 700;
  background: #f97316; color: #fff;
  padding: 1px 5px; border-radius: 4px;
  vertical-align: middle; margin-left: 4px;
}
.competitor-inline-tag {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: .65rem; padding: 2px 7px; border-radius: 4px;
  background: rgba(239,68,68,.1); color: #ef4444;
  border: 1px solid rgba(239,68,68,.2);
  cursor: pointer; transition: background .15s;
}
.competitor-inline-tag:hover { background: rgba(239,68,68,.2); }

/* ---- 競合カードの news-summary ---- */
.competitor-news-summary {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 12px;
}
.news-summary-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .68rem; font-weight: 600;
  padding: 3px 9px; border-radius: 99px;
}
.news-summary-badge.pr  { background: rgba(0,105,192,.1); color: #0069c0; border: 1px solid rgba(0,105,192,.2); }
.news-summary-badge.rel { background: rgba(16,185,129,.1); color: #10b981; border: 1px solid rgba(16,185,129,.2); }

.btn-detail {
  font-size: .75rem; padding: 5px 12px;
  background: var(--bg-base); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-secondary);
  display: flex; align-items: center; gap: 5px;
  transition: all .18s;
}
.btn-detail:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---- エラー詳細 ---- */
.source-error-detail {
  margin-top: 8px; font-size: .7rem; color: #ef4444;
  background: rgba(239,68,68,.05); border: 1px solid rgba(239,68,68,.15);
  border-radius: 6px; padding: 6px 10px; word-break: break-all;
}

/* ============================================================
   競合詳細ビュー
   ============================================================ */
.btn-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .8rem; color: var(--text-secondary);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 7px 14px;
  margin-bottom: 20px; transition: all .18s;
}
.btn-back:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.comp-detail-header {
  display: flex; align-items: flex-start; gap: 18px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.comp-detail-icon {
  width: 54px; height: 54px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.3rem; flex-shrink: 0;
}
.comp-detail-meta { flex: 1; }
.comp-detail-name {
  font-size: 1.4rem; font-weight: 800;
  color: var(--text-primary); margin-bottom: 6px;
}
.comp-detail-sub {
  display: flex; flex-wrap: wrap; gap: 12px;
  font-size: .78rem; color: var(--text-muted); margin-bottom: 6px;
}
.comp-detail-sub span { display: flex; align-items: center; gap: 4px; }
.comp-detail-desc {
  font-size: .85rem; color: var(--text-secondary);
  line-height: 1.65; margin-top: 10px;
}

.comp-detail-links {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px;
}
.btn-comp-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .8rem; padding: 7px 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-secondary);
  transition: all .18s;
}
.btn-comp-link:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-comp-link.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-comp-link.primary:hover { background: var(--primary-light); }

/* タブ */
.comp-detail-tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.comp-tab {
  display: flex; align-items: center; gap: 5px;
  padding: 9px 16px; font-size: .82rem; font-weight: 600;
  border: none; background: transparent;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .18s;
}
.comp-tab:hover { color: var(--text-primary); }
.comp-tab.active {
  color: var(--primary-light);
  border-bottom-color: var(--primary-light);
}

.comp-tab-panel { display: none; }
.comp-tab-panel.active { display: block; animation: viewFadeIn .2s ease; }
.comp-news-grid { margin-top: 4px; }

/* ============================================================
   ユーティリティ
   ============================================================ */
.hidden  { display: none !important; }
.fade-in { animation: viewFadeIn .3s ease both; }

/* ============================================================
   競合インテリジェンスビュー
   ============================================================ */

/* ---- 企業セレクタ ---- */
.intel-company-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.intel-company-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  font-size: .78rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all .18s ease;
  box-shadow: var(--shadow-sm);
}
.intel-company-chip:hover {
  border-color: var(--primary-light);
  color: var(--primary-light);
  transform: translateY(-1px);
}
.intel-company-chip.active {
  font-weight: 600;
  color: var(--text-primary);
}
.intel-chip-score {
  font-size: .72rem;
  font-weight: 700;
  margin-left: 2px;
  min-width: 24px;
  text-align: center;
}

/* ---- 未取得バナー ---- */
.intel-no-data-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  background: rgba(245,158,11,.08);
  border: 1px solid rgba(245,158,11,.25);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.intel-no-data-banner i {
  font-size: 1.4rem;
  color: #f59e0b;
  flex-shrink: 0;
}
.intel-no-data-banner div {
  flex: 1;
  font-size: .82rem;
  color: var(--text-secondary);
  min-width: 160px;
}
.intel-no-data-banner strong {
  color: var(--text-primary);
  display: block;
  margin-bottom: 2px;
}
.btn-fetch-intel {
  padding: 7px 14px;
  border-radius: 8px;
  background: #f59e0b;
  color: #fff;
  border: none;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  transition: background .18s;
}
.btn-fetch-intel:hover { background: #d97706; }
.btn-fetch-intel:disabled { opacity: .6; cursor: default; }

/* ---- 企業ヘッダー ---- */
.intel-detail-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.intel-detail-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.1rem;
  flex-shrink: 0;
}

/* ---- KPI行 ---- */
.intel-kpi-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.intel-kpi {
  flex: 1;
  min-width: 80px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
  text-align: center;
  border: 1px solid var(--border);
}
.intel-kpi-num {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.intel-kpi-label {
  font-size: .65rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---- センチメントバー ---- */
.intel-sentiment-bar-wrap {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
.intel-sentiment-labels {
  display: flex;
  justify-content: space-between;
  font-size: .72rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.intel-sentiment-bar {
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  background: var(--bg-base);
}
.intel-bar-pos { background: #10b981; transition: width .4s ease; }
.intel-bar-neu { background: #94a3b8; transition: width .4s ease; }
.intel-bar-neg { background: #ef4444; transition: width .4s ease; }

/* ---- チャートセクション ---- */
.intel-chart-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
.intel-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}
.intel-chart-title {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.intel-chart-legend {
  display: flex;
  gap: 12px;
  font-size: .7rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.intel-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* ---- ローディングバナー ---- */
.intel-loading-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: rgba(34,86,160,.08);
  border: 1px solid rgba(34,86,160,.2);
  border-radius: var(--radius-sm);
  font-size: .82rem;
  color: var(--primary-light);
  margin-bottom: 16px;
}

/* ---- 記事タブ・リスト ---- */
.intel-articles-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
.intel-article-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}
.intel-tab {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: transparent;
  font-size: .75rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .16s;
}
.intel-tab:hover { background: var(--bg-base); }
.intel-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.intel-article-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 480px;
  overflow-y: auto;
}
.intel-article-card {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-base);
  transition: box-shadow .16s;
}
.intel-article-card:hover {
  box-shadow: var(--shadow-md);
}
.intel-sentiment-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: .65rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.intel-article-title {
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  line-height: 1.4;
  flex: 1;
}
.intel-article-title:hover { color: var(--primary-light); text-decoration: underline; }
.intel-article-excerpt {
  font-size: .75rem;
  color: var(--text-secondary);
  margin: 6px 0 0;
  line-height: 1.5;
}
.intel-article-meta {
  display: flex;
  gap: 12px;
  font-size: .68rem;
  color: var(--text-muted);
  margin-top: 7px;
  flex-wrap: wrap;
}

/* ============================================================
   ダッシュボード: センチメント速報グリッド
   ============================================================ */
.sentiment-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}
.sentiment-quick-card {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .18s ease;
}
.sentiment-quick-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.sentiment-bar-mini {
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  background: var(--bg-base);
  margin-top: 4px;
}
.sentiment-bar-seg {
  transition: width .4s ease;
}
.sentiment-bar-seg.pos { background: #10b981; }
.sentiment-bar-seg.neu { background: #94a3b8; }
.sentiment-bar-seg.neg { background: #ef4444; }

/* ============================================================
   レスポンシブ対応（インテリジェンスビュー）
   ============================================================ */
@media (max-width: 768px) {
  .intel-kpi-row { gap: 8px; }
  .intel-kpi { min-width: 70px; padding: 10px 12px; }
  .intel-kpi-num { font-size: 1.2rem; }
  .intel-detail-header { flex-wrap: wrap; }
  .intel-chart-section { padding: 14px 14px; }
  .sentiment-quick-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .intel-company-chip { font-size: .72rem; padding: 5px 10px; }
}
@media (max-width: 480px) {
  .intel-sentiment-labels { font-size: .65rem; }
  .intel-article-tabs { gap: 4px; }
  .intel-tab { font-size: .68rem; padding: 4px 8px; }
}
