/* Instagram成果画面専用。既存画面へ影響しないよう #insights-view で名前空間化。 */
#insights-view.insights-dashboard {
  --insight-ink:#172738;
  --insight-muted:#607083;
  --insight-line:#dbe4ec;
  --insight-panel:#fff;
  --insight-blue:#2366ac;
  --insight-cyan:#1685a6;
  --insight-green:#218064;
  --insight-amber:#c6870b;
  --insight-rose:#c73e6f;
  --insight-violet:#7053b2;
  color:var(--insight-ink);
}

#insights-view .insights-page-head {
  margin:-4px 0 18px;
  padding:22px 24px;
  border:1px solid #cfe0ef;
  border-radius:16px;
  background:linear-gradient(120deg,#fff 0%,#f2f8ff 72%,#fff7df 100%);
  box-shadow:0 12px 30px rgba(35,76,117,.07);
}
#insights-view .insights-page-head h2 { font-size:clamp(20px,2.4vw,28px); letter-spacing:-.02em; }
#insights-view .insights-page-head p { max-width:720px; color:#50657a; }
#insights-view .insights-page-head button { border-color:#8db3d7; color:#164f87; background:#fff; }
#insights-view .insights-sample-notice {
  display:flex;
  align-items:flex-start;
  gap:10px;
  margin:0 0 16px;
  padding:13px 16px;
  border:1px solid #dfb64e;
  border-left:5px solid #d49c11;
  border-radius:10px;
  background:#fff8df;
  color:#5f4509;
  font-weight:650;
}
#insights-view .insights-sample-notice::before { content:'i'; flex:none; display:grid; place-items:center; width:20px; height:20px; border-radius:50%; background:#d49c11; color:#fff; font:700 12px/1 sans-serif; }

#insights-view .insights-filters {
  position:relative;
  display:grid;
  grid-template-columns:repeat(4,minmax(150px,1fr));
  gap:12px;
  align-items:end;
  margin:0;
  padding:18px;
  border:1px solid var(--insight-line);
  border-radius:14px;
  background:#fff;
  box-shadow:0 6px 20px rgba(31,61,91,.045);
}
#insights-view .insights-filters label { min-width:0; margin:0; color:#42566a; }
#insights-view .insights-filters select,
#insights-view .insights-filters input { border-color:#cbd8e4; background:#f9fbfd; }
#insights-view .insights-filters + .help { margin:8px 4px 24px; }

#insights-view .insights-account-panel,
#insights-view .insights-summary-panel,
#insights-view .insights-panel,
#insights-view .insights-ranking-section {
  margin-top:18px;
  padding:22px;
  border:1px solid var(--insight-line);
  border-radius:16px;
  background:var(--insight-panel);
  box-shadow:0 8px 24px rgba(34,65,96,.055);
}
#insights-view .insights-panel-head {
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:18px;
  margin-bottom:18px;
}
#insights-view .insights-panel-head h3 { margin:1px 0 0; font-size:18px; letter-spacing:-.01em; }
#insights-view .insights-panel-head p { margin:4px 0 0; color:var(--insight-muted); font-size:12px; }
#insights-view .insights-eyebrow { display:block; color:var(--insight-blue); font-size:10px; font-weight:800; letter-spacing:.16em; }
#insights-view .insights-sample-badge,
#insights-view .insights-row-sample {
  display:inline-flex;
  align-items:center;
  width:max-content;
  padding:3px 8px;
  border:1px solid #dfb64e;
  border-radius:999px;
  background:#fff6d8;
  color:#775708;
  font-size:10px;
  font-weight:800;
  letter-spacing:.03em;
  white-space:nowrap;
}

#insights-view .insights-account-meta { display:grid; justify-items:end; gap:3px; color:var(--insight-muted); font-size:11px; }
#insights-view .insights-account-layout { display:grid; grid-template-columns:minmax(190px,.42fr) minmax(0,1.58fr); gap:18px; }
#insights-view .insights-account-primary {
  display:flex;
  min-height:210px;
  flex-direction:column;
  justify-content:center;
  padding:26px;
  border-radius:14px;
  color:#fff;
  background:linear-gradient(145deg,#153f6a,#1f6eb4 62%,#278db0);
  box-shadow:0 12px 28px rgba(24,91,151,.19);
}
#insights-view .insights-account-primary span { font-size:13px; color:#dceeff; }
#insights-view .insights-account-primary strong { margin:7px 0 3px; font-size:clamp(34px,5vw,52px); line-height:1; letter-spacing:-.04em; }
#insights-view .insights-account-primary small { color:#dceeff; }
#insights-view .insights-account-groups { display:grid; gap:15px; }
#insights-view .insights-account-group { padding:15px; border:1px solid #e3e9ef; border-radius:13px; background:#f8fafc; }
#insights-view .insights-account-group h4 { margin:0 0 10px; color:#536679; font-size:12px; }
#insights-view .insights-account-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; }

#insights-view .insights-kpi-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }
#insights-view .insights-metric {
  position:relative;
  min-width:0;
  overflow:hidden;
  padding:15px 16px 14px;
  border:1px solid #dce6ee;
  border-radius:12px;
  background:#fff;
}
#insights-view .insights-metric::before { content:''; position:absolute; inset:0 auto 0 0; width:4px; background:var(--metric-color,var(--insight-blue)); }
#insights-view .insights-metric[data-tone="navy"] { --metric-color:#203c58; --metric-soft:#edf2f6; }
#insights-view .insights-metric[data-tone="blue"] { --metric-color:var(--insight-blue); --metric-soft:#edf5fd; }
#insights-view .insights-metric[data-tone="cyan"] { --metric-color:var(--insight-cyan); --metric-soft:#eaf8fb; }
#insights-view .insights-metric[data-tone="green"] { --metric-color:var(--insight-green); --metric-soft:#ebf7f2; }
#insights-view .insights-metric[data-tone="amber"] { --metric-color:var(--insight-amber); --metric-soft:#fff6df; }
#insights-view .insights-metric[data-tone="rose"] { --metric-color:var(--insight-rose); --metric-soft:#fff0f5; }
#insights-view .insights-metric[data-tone="violet"] { --metric-color:var(--insight-violet); --metric-soft:#f4f0ff; }
#insights-view .insights-account-group .insights-metric { background:var(--metric-soft,#fff); }
#insights-view .insights-metric-label { display:block; min-height:1.5em; color:#53677a; font-size:11px; font-weight:700; }
#insights-view .insights-metric strong { display:block; margin:3px 0 1px; color:var(--insight-ink); font-size:clamp(22px,2.5vw,30px); line-height:1.3; letter-spacing:-.025em; }
#insights-view .insights-metric small { display:block; overflow:hidden; color:#6a7b8b; font-size:10px; text-overflow:ellipsis; white-space:nowrap; }

#insights-view .insights-analysis { margin-top:20px; }
#insights-view .insights-visual-grid { display:grid; grid-template-columns:minmax(0,.88fr) minmax(0,1.12fr); gap:18px; }
#insights-view .insights-panel { margin-top:0; }
#insights-view .insights-reaction-body { display:grid; grid-template-columns:174px minmax(0,1fr); gap:22px; align-items:center; }
#insights-view .insights-donut { display:grid; width:174px; aspect-ratio:1; place-items:center; padding:22px; border-radius:50%; background:var(--insights-donut); box-shadow:inset 0 0 0 1px rgba(0,0,0,.04); }
#insights-view .insights-donut > div { display:grid; width:100%; height:100%; place-content:center; border-radius:50%; background:#fff; text-align:center; box-shadow:0 2px 14px rgba(34,65,96,.14); }
#insights-view .insights-donut strong { font-size:25px; line-height:1.1; }
#insights-view .insights-donut span { color:var(--insight-muted); font-size:10px; }
#insights-view .insights-legend { display:grid; gap:7px; margin:0; }
#insights-view .insights-legend > div { display:grid; grid-template-columns:1fr auto; gap:10px; align-items:center; padding-bottom:7px; border-bottom:1px solid #edf1f4; }
#insights-view .insights-legend > div:last-child { border-bottom:0; }
#insights-view .insights-legend dt { display:flex; align-items:center; gap:8px; color:#4e6275; font-size:12px; }
#insights-view .insights-legend dt i { width:9px; height:9px; border-radius:50%; background:var(--legend-color); }
#insights-view .insights-legend dd { display:grid; margin:0; text-align:right; }
#insights-view .insights-legend dd strong { font-size:15px; }
#insights-view .insights-legend dd small { color:#778696; font-size:9px; }
#insights-view .insights-panel-note { margin:15px 0 0; padding-top:12px; border-top:1px solid #edf1f4; color:var(--insight-muted); font-size:10px; }

#insights-view .insights-bars { display:grid; gap:13px; margin:0; padding:0; list-style:none; }
#insights-view .insights-bars li { min-width:0; }
#insights-view .insights-bar-copy { display:grid; grid-template-columns:30px minmax(0,1fr) auto; gap:8px; align-items:center; }
#insights-view .insights-bar-copy span { color:var(--insight-blue); font-size:10px; font-weight:800; }
#insights-view .insights-bar-copy strong { overflow:hidden; font-size:11px; font-weight:650; text-overflow:ellipsis; white-space:nowrap; }
#insights-view .insights-bar-copy b { font-size:13px; }
#insights-view .insights-bar-track { height:8px; margin:6px 0 3px 38px; overflow:hidden; border-radius:999px; background:#eaf0f5; }
#insights-view .insights-bar-track i { display:block; width:var(--bar-size); min-width:2px; height:100%; border-radius:inherit; background:linear-gradient(90deg,#1f68ae,#30a1b4); }
#insights-view .insights-bars li small { display:block; margin-left:38px; color:#788797; font-size:9px; }

#insights-view .insights-ranking-section { margin-top:18px; }
#insights-view .insights-ranking-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
#insights-view .insights-rank-card { overflow:hidden; border:1px solid #dfe7ed; border-radius:12px; background:#fbfcfd; }
#insights-view .insights-rank-card h4 { margin:0; padding:12px 14px; border-bottom:1px solid #e1e8ee; color:#27445f; background:#f0f6fb; font-size:12px; }
#insights-view .insights-rank-card[data-metric="saved"] h4 { color:#715109; background:#fff7e2; }
#insights-view .insights-rank-card ol { display:grid; margin:0; padding:0; list-style:none; counter-reset:rank; }
#insights-view .insights-rank-card li { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px; align-items:center; padding:10px 13px; border-bottom:1px solid #e8edf1; counter-increment:rank; }
#insights-view .insights-rank-card li:last-child { border-bottom:0; }
#insights-view .insights-rank-card li > div { display:grid; min-width:0; grid-template-columns:22px minmax(0,1fr); }
#insights-view .insights-rank-card li > div::before { content:counter(rank); grid-row:1/3; display:grid; width:18px; height:18px; place-items:center; border-radius:50%; color:#fff; background:#365f84; font-size:9px; font-weight:800; }
#insights-view .insights-rank-card li strong { overflow:hidden; font-size:11px; font-weight:650; text-overflow:ellipsis; white-space:nowrap; }
#insights-view .insights-rank-card li span { color:#7a8997; font-size:9px; }
#insights-view .insights-rank-card li b { color:#153f67; font-size:13px; }
#insights-view .insights-empty { margin:0; padding:24px; color:var(--insight-muted); text-align:center; }

#insights-view .insights-table-head { margin:30px 0 12px; padding-top:22px; border-top:1px solid #ced9e2; }
#insights-view .insights-table-head h3 { font-size:18px; }
#insights-view .insights-table-wrap { border-radius:14px; border-color:#d2dde6; box-shadow:0 8px 22px rgba(34,65,96,.045); }
#insights-view .insights-table-wrap table { min-width:1080px; }
#insights-view .insights-table-wrap th { position:sticky; top:0; z-index:1; padding:11px 10px; border-bottom-color:#cdd9e3; color:#506378; background:#eef4f8; font-size:10px; font-weight:800; }
#insights-view .insights-table-wrap td { padding:13px 10px; vertical-align:middle; }
#insights-view .insights-table-wrap tbody tr:nth-child(even) { background:#fafcfd; }
#insights-view .insights-table-wrap tbody tr:hover { background:#f1f7fc; }
#insights-view .insights-table-wrap tbody tr.is-sample { box-shadow:inset 3px 0 #dcad31; }
#insights-view .insights-post-cell { display:grid; gap:5px; }
#insights-view .insights-post-meta { display:flex; align-items:center; gap:7px; color:#6f7f8e; font-size:10px; }
#insights-view .insights-post-cell a,
#insights-view .insights-post-title { display:-webkit-box; overflow:hidden; color:#213b54; font-size:11px; font-weight:650; line-height:1.55; text-decoration:none; -webkit-box-orient:vertical; -webkit-line-clamp:2; }
#insights-view .insights-post-cell a:hover { color:var(--insight-blue); text-decoration:underline; }
#insights-view .insights-format-badge { display:inline-flex; padding:3px 7px; border-radius:999px; color:#1c5a8f; background:#eaf4fd; font-size:9px; font-weight:800; }
#insights-view .insights-format-badge[data-format="REELS"] { color:#745212; background:#fff2ce; }
#insights-view .insights-format-badge[data-format="STORIES"] { color:#6c4e9c; background:#f1eaff; }
#insights-view .insights-format-badge[data-format="CAROUSEL"] { color:#18705a; background:#e6f6ef; }
#insights-view .insights-number span { display:inline-flex; min-width:52px; justify-content:flex-end; font-variant-numeric:tabular-nums; font-weight:700; }
#insights-view .insights-number[data-state="missing"] span { color:#8793a0; font-size:10px; font-weight:500; }
#insights-view .insights-fetched span { color:#6d7e8e; font-size:10px; }
#insights-view .insights-table-empty { padding:40px !important; color:var(--insight-muted); text-align:center !important; }

@media (max-width: 980px) {
  #insights-view .insights-filters { grid-template-columns:repeat(2,minmax(0,1fr)); }
  #insights-view .insights-account-layout { grid-template-columns:1fr; }
  #insights-view .insights-account-primary { min-height:150px; }
  #insights-view .insights-account-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  #insights-view .insights-kpi-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  #insights-view .insights-visual-grid { grid-template-columns:1fr; }
}
@media (max-width: 640px) {
  #insights-view .insights-page-head { padding:18px; }
  #insights-view .insights-page-head button { width:100%; }
  #insights-view .insights-filters { grid-template-columns:1fr; padding:14px; }
  #insights-view .insights-account-panel,
  #insights-view .insights-summary-panel,
  #insights-view .insights-panel,
  #insights-view .insights-ranking-section { padding:17px; border-radius:13px; }
  #insights-view .insights-panel-head { flex-direction:column; gap:9px; }
  #insights-view .insights-account-meta { justify-items:start; }
  #insights-view .insights-account-grid,
  #insights-view .insights-kpi-grid,
  #insights-view .insights-ranking-grid { grid-template-columns:1fr; }
  #insights-view .insights-reaction-body { grid-template-columns:1fr; justify-items:center; }
  #insights-view .insights-legend { width:100%; }
  #insights-view .insights-table-head { align-items:stretch; }
  #insights-view .insights-table-head .inline { justify-content:space-between; }
}

@media (prefers-reduced-motion: reduce) {
  #insights-view * { scroll-behavior:auto !important; }
}
