:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f7f7f7;
  --text: #0f0f10;
  --muted: #7b818b;
  --line: #e7e4df;
  --line-strong: #cfc8bc;
  --blue: #001a70;
  --teal: #0a6f73;
  --violet: #5b4aa1;
  --amber: #8b6914;
  --red: #b42318;
  --green: #1d7a46;
  --slate: #2f2f2f;
  --beige: #ece7df;
  --light-beige: #f4f0ea;
  --dark-beige: #8b8172;
  --header: #303030;
  --shadow: 0 10px 28px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Yu Gothic UI", "Yu Gothic", "Meiryo", "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
  cursor: pointer;
}

button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

input,
select {
  width: 100%;
  height: 40px;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
}

.app-header {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 7px 24px;
  background: var(--header);
  border-bottom: 0;
}

.app-header h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
  font-weight: 600;
  color: #ffffff;
  text-shadow: 0 2px 3px rgba(0, 26, 112, 0.6);
}

.app-header p {
  display: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-actions select {
  width: 210px;
  height: 34px;
  border-radius: 6px;
  border-color: rgba(255, 255, 255, 0.65);
  background: #ffffff;
  color: var(--blue);
  font-weight: 700;
}

#exportStaticButton {
  border-color: #ffffff;
  background: #ffffff;
  color: var(--blue);
  font-weight: 700;
}

#exportStaticButton:hover {
  border-color: var(--light-beige);
  background: var(--light-beige);
  color: var(--blue);
}

#reloadButton {
  border-color: rgba(255, 255, 255, 0.55);
  background: transparent;
  color: #ffffff;
}

#reloadButton:hover {
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.app-shell {
  height: calc(100vh - 52px);
  display: grid;
  grid-template-columns: 252px minmax(520px, 1fr) 360px;
  gap: 0;
  background: #ffffff;
}

.sidebar,
.detail-pane {
  min-width: 0;
  overflow: auto;
  background: var(--surface);
}

.sidebar {
  position: relative;
  margin-top: 16px;
  height: calc(100% - 16px);
  border-right: 0;
  border-radius: 0 28px 28px 0;
  background: var(--beige);
  padding: 92px 18px 18px;
}

.sidebar::before {
  content: "InsightForge";
  position: absolute;
  top: 20px;
  left: 0;
  right: -10px;
  height: 56px;
  display: flex;
  align-items: center;
  padding-left: 24px;
  border-radius: 0 30px 30px 0;
  background: var(--blue);
  color: #ffffff;
  font-size: 17px;
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(0, 26, 112, 0.18);
}

.detail-pane {
  border-left: 1px solid #efefef;
  background: #ffffff;
}

.workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: 62px minmax(0, 1fr);
  background: #ffffff;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px 10px;
  background: #ffffff;
  border-bottom: 0;
}

.tab {
  min-width: 96px;
  border-radius: 999px;
  border-color: #e4e4e4;
  background: #ffffff;
  color: var(--blue);
  font-weight: 700;
}

.tab.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
  font-weight: 700;
}

.tab-panel {
  display: none;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

.tab-panel.active {
  display: block;
}

.tool-section {
  margin-bottom: 18px;
}

.tool-section label {
  display: block;
  margin-bottom: 6px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: 16px;
  height: 16px;
}

.check-row label {
  margin: 0;
  font-weight: 500;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat {
  border: 1px solid rgba(0, 26, 112, 0.08);
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.stat strong {
  display: block;
  font-size: 20px;
  color: var(--blue);
}

.stat span {
  color: var(--muted);
  font-size: 12px;
}

.export-stat {
  grid-column: span 2;
}

.export-stat strong {
  font-size: 15px;
}

.graph-toolbar {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 18px 12px;
  padding: 6px 10px;
  background: #f2f2f2;
  border: 0;
  border-radius: 8px;
}

.graph-toolbar button {
  min-width: 84px;
  border-color: var(--blue);
  border-radius: 999px;
  background: var(--blue);
  color: #ffffff;
  font-weight: 700;
}

.graph-toolbar button:hover {
  background: #00135a;
  color: #ffffff;
}

#graphHint {
  color: var(--muted);
  font-size: 12px;
}

#graphCanvas {
  display: block;
  width: calc(100% - 36px);
  height: calc(100vh - 188px);
  margin: 0 18px 18px;
  border: 1px solid #f0f0f0;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(0, 26, 112, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(0, 26, 112, 0.04) 1px, transparent 1px),
    #ffffff;
  background-size: 32px 32px, 32px 32px, auto;
}

.detail-view {
  margin: 18px 16px;
  padding: 16px;
  border: 1px solid #eeeeee;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
}

.detail-view h2 {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 20px;
}

.detail-view h3 {
  margin: 18px 0 8px;
  font-size: 13px;
  color: #344054;
}

.muted {
  color: var(--muted);
}

.pill-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef1f8;
  color: var(--blue);
  font-size: 12px;
}

.pill.source-note { background: #dbeafe; color: #1d4ed8; }
.pill.topic { background: #ede9fe; color: #6d28d9; }
.pill.organization { background: #ccfbf1; color: #0f766e; }
.pill.source-asset { background: #fef3c7; color: #92400e; }
.pill.broken { background: #ffedd5; color: #c2410c; }

.link-list {
  display: grid;
  gap: 6px;
}

.link-list button,
.file-link {
  height: auto;
  min-height: 30px;
  text-align: left;
  justify-content: start;
  white-space: normal;
}

.file-link {
  display: inline-flex;
  align-items: center;
  color: var(--blue);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--surface);
  font-weight: 700;
}

.file-link:hover {
  border-color: var(--blue);
}

.file-link.disabled {
  color: var(--muted);
  background: var(--surface-soft);
  cursor: default;
}

.table-wrap {
  padding: 4px 18px 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid #efefef;
  border-radius: 8px;
  overflow: hidden;
  font-size: 13px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.05);
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid #edf1f5;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--light-beige);
  color: var(--blue);
  font-weight: 700;
  white-space: nowrap;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover td {
  background: #f7f4ef;
}

.amount {
  color: var(--amber);
  font-weight: 700;
}

.coverage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  padding: 14px;
}

.trend-view {
  padding: 4px 18px 18px;
}

.quality-view {
  padding: 4px 18px 18px;
}

.trend-hero,
.quality-hero,
.trend-message,
.trend-panel,
.trend-cluster,
.quality-score {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.trend-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 18px;
  align-items: center;
  padding: 22px;
}

.trend-hero,
.quality-hero {
  border-left: 0;
}

.quality-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 22px;
}

.eyebrow,
.mini-label {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.trend-hero h2,
.quality-hero h2 {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 32px;
  line-height: 1.35;
  text-shadow: 0 3px 6px rgba(0, 26, 112, 0.12);
}

.quality-hero h2 span {
  color: var(--blue);
  font-size: 18px;
}

.trend-kpis {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.trend-message {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  padding: 14px 16px;
  border-left: 0;
}

.trend-message strong {
  display: block;
  font-size: 17px;
}

.trend-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.quality-score-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.trend-cluster {
  padding: 14px;
}

.quality-score {
  padding: 16px;
}

.score-bar {
  height: 8px;
  margin: 12px 0 8px;
  border-radius: 6px;
  background: #e4ddd1;
  overflow: hidden;
}

.score-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.quality-score p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.quality-actions {
  display: flex;
  justify-content: end;
}

.trend-cluster.governance-coe { border-top: 4px solid var(--blue); }
.trend-cluster.ai-production { border-top: 4px solid var(--teal); }
.trend-cluster.data-foundation { border-top: 4px solid var(--amber); }
.trend-cluster.ops-bpo { border-top: 4px solid var(--slate); }

.cluster-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cluster-head h3,
.trend-panel h3 {
  margin: 0;
  color: var(--blue);
  font-size: 15px;
}

.cluster-head span {
  min-width: 44px;
  text-align: center;
  border-radius: 6px;
  background: var(--blue);
  padding: 3px 8px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.trend-cluster p {
  min-height: 42px;
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.trend-proposal-list {
  display: grid;
  gap: 6px;
}

.trend-proposal {
  height: auto;
  min-height: 46px;
  display: grid;
  gap: 3px;
  justify-items: start;
  text-align: left;
  white-space: normal;
  border-color: transparent;
  background: var(--light-beige);
  color: var(--blue);
  font-weight: 700;
}

.trend-proposal strong,
.trend-proposal span {
  max-width: 100%;
}

.trend-proposal span {
  color: var(--muted);
  font-size: 12px;
}

.trend-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.trend-panel {
  padding: 16px;
}

.insight-list {
  margin: 10px 0 0;
  padding-left: 22px;
  color: #344054;
  font-size: 13px;
  line-height: 1.7;
}

.amount-range {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin: 16px 0 10px;
  color: var(--slate);
  font-weight: 700;
}

.amount-range div {
  height: 8px;
  border-radius: 999px;
  background: #e4eaf1;
  overflow: hidden;
}

.amount-range i {
  display: block;
  width: 68%;
  height: 100%;
  background: var(--blue);
}

.bar-list {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(90px, 1.4fr) 24px;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}

.bar-row div {
  height: 8px;
  border-radius: 999px;
  background: #e4eaf1;
  overflow: hidden;
}

.bar-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.bar-row strong {
  text-align: right;
}

.theme-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.theme-cloud span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, #eef1f8 calc(var(--weight) * 100%), #fff);
  padding: 6px 10px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

.theme-cloud b {
  margin-left: 4px;
  color: var(--slate);
}

.mini-table {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.mini-table > button,
.mini-table > div {
  height: auto;
  min-height: 48px;
  display: grid;
  gap: 3px;
  justify-items: start;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--light-beige);
  padding: 9px 10px;
  white-space: normal;
}

.mini-table strong,
.mini-table span,
.mini-table small {
  max-width: 100%;
}

.mini-table span,
.mini-table small {
  color: var(--muted);
  font-size: 12px;
}

.cluster-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.cluster-summary p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.coverage-section {
  margin: 0 18px 14px;
  border: 1px solid #efefef;
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.05);
}

.coverage-section h3 {
  margin: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--blue);
  font-size: 14px;
}

.issue-list {
  margin: 0;
  padding: 12px 18px 14px 30px;
  color: #344054;
  font-size: 13px;
}

.issue-list li {
  margin: 5px 0;
}

.ok {
  color: var(--green);
}

.warn {
  color: var(--red);
}

.preview {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.6;
}

@media (max-width: 1160px) {
  .app-shell {
    grid-template-columns: 230px minmax(420px, 1fr);
  }

  .detail-pane {
    grid-column: 1 / -1;
    height: 320px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .trend-hero,
  .quality-hero,
  .trend-grid,
  .quality-score-grid,
  .trend-two-col {
    grid-template-columns: 1fr;
  }

  .quality-actions {
    justify-content: start;
  }
}
