/* Solid Gray palette — デジタル庁ダッシュボードガイドブック準拠 + リッチ装飾 */
:root {
  color-scheme: light;
  --bg: #F1F1F3;
  --bg-grad-from: #F4F4F5;
  --bg-grad-to: #E7E7EA;

  --surface: #FFFFFF;
  --surface-alt: #FAFAFA;
  --surface-highlight: #F5F5F4;
  --surface-elev: #FFFFFF;

  --border: #D4D4D8;
  --border-soft: #E4E4E7;
  --border-strong: #A1A1AA;

  --text: #18181B;
  --text-sub: #3F3F46;
  --text-label: #52525B;
  --text-muted: #71717A;
  --link: #1D4ED8;

  /* チャートカラー：Solid Gray 一本。強弱は濃淡で表現。 */
  --chart-primary: #18181B;
  --chart-primary-soft: #3F3F46;
  --chart-secondary: #71717A;
  --chart-neutral: #D4D4D8;
  --chart-neutral-soft: #E4E4E7;
  --chart-accent: #18181B;

  /* データ出典色：EDINET実績=濃グレー / 推定値=オークル（徽妙なアクセント） */
  --src-edinet: #18181B;
  --src-edinet-soft: #3F3F46;
  --src-edinet-bg: rgba(24,24,27,0.06);
  --src-estimate: #A16207;
  --src-estimate-soft: #CA8A04;
  --src-estimate-bg: #FEFCE8;
  --src-estimate-line: #CA8A04;

  /* カテゴリ識別：4 区分を濃淡で表現。色相は使わない。 */
  --cat-consul-bg: #18181B;       /* ITコンサル：黒 */
  --cat-consul-fg: #FFFFFF;
  --cat-consul-dot: #18181B;
  --cat-strategy-bg: #3F3F46;     /* 戦略系：濃グレー */
  --cat-strategy-fg: #FFFFFF;
  --cat-strategy-dot: #3F3F46;
  --cat-sogo-bg: #71717A;         /* 総合系：中グレー */
  --cat-sogo-fg: #FFFFFF;
  --cat-sogo-dot: #71717A;
  --cat-sier-bg: #E4E4E7;         /* SIer：薄グレー */
  --cat-sier-fg: #18181B;
  --cat-sier-dot: #A1A1AA;

  --positive: #18181B;
  --negative: #18181B;

  --shadow-card: 0 1px 2px rgba(24,24,27,0.04), 0 1px 3px rgba(24,24,27,0.06);
  --shadow-elev: 0 4px 16px rgba(24,24,27,0.08), 0 1px 2px rgba(24,24,27,0.04);

  --font-ja: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-num: "Inter", "Noto Sans JP", system-ui, sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0A0A0C;
  --bg-grad-from: #0F0F12;
  --bg-grad-to: #050507;

  --surface: #131317;
  --surface-alt: #18181C;
  --surface-highlight: #1E1E23;
  --surface-elev: #16161B;

  --border: #2A2A31;
  --border-soft: #212127;
  --border-strong: #3F3F46;

  --text: #F4F4F5;
  --text-sub: #D4D4D8;
  --text-label: #A1A1AA;
  --text-muted: #71717A;
  --link: #93C5FD;

  --chart-primary: #F4F4F5;
  --chart-primary-soft: #D4D4D8;
  --chart-secondary: #A1A1AA;
  --chart-neutral: #3F3F46;
  --chart-neutral-soft: #27272A;
  --chart-accent: #F4F4F5;

  --src-edinet: #F4F4F5;
  --src-edinet-soft: #D4D4D8;
  --src-edinet-bg: rgba(244,244,245,0.08);
  --src-estimate: #FBBF24;
  --src-estimate-soft: #F59E0B;
  --src-estimate-bg: rgba(251,191,36,0.16);
  --src-estimate-line: #FBBF24;

  --cat-consul-bg: #F4F4F5;
  --cat-consul-fg: #09090B;
  --cat-consul-dot: #F4F4F5;
  --cat-strategy-bg: #D4D4D8;
  --cat-strategy-fg: #09090B;
  --cat-strategy-dot: #D4D4D8;
  --cat-sogo-bg: #71717A;
  --cat-sogo-fg: #F4F4F5;
  --cat-sogo-dot: #A1A1AA;
  --cat-sier-bg: #27272A;
  --cat-sier-fg: #D4D4D8;
  --cat-sier-dot: #71717A;

  --positive: #F4F4F5;
  --negative: #F4F4F5;

  --shadow-card: 0 1px 2px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.02);
  --shadow-elev: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ja);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 1400px 600px at 50% -200px, var(--bg-grad-from), var(--bg-grad-to));
  background-attachment: fixed;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  font-feature-settings: "palt";
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }

/* ===== Layout ===== */
.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 48px;
}

/* ===== Header ===== */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 0 16px;
  margin-bottom: 20px;
  position: relative;
}
.app-header::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
  opacity: 0.3;
}
.app-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}
.brand-mark {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-mark .logo-mark {
  width: 44px;
  height: 44px;
  min-width: 44px;
  flex-shrink: 0;
  display: block;
  color: var(--text);
}
.brand-mark .logo-mark .accent { fill: var(--src-estimate); }
.brand-mark .logo-mark .fg { fill: currentColor; }
.brand-mark .logo-mark .fg-soft { fill: currentColor; opacity: 0.15; }
.app-header h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 3px;
  letter-spacing: 0.02em;
  font-family: 'Inter', var(--font-num);
}
.app-header h1 .h1-sub {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-left: 6px;
  font-family: 'Noto Sans JP', sans-serif;
}
.app-header .subtitle {
  font-size: 11px;
  color: var(--text-label);
  margin: 0;
  letter-spacing: 0.02em;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 18px;
}
.meta-stack {
  font-size: 10.5px;
  color: var(--text-muted);
  text-align: right;
  line-height: 1.7;
  letter-spacing: 0.02em;
}
.meta-stack strong { color: var(--text); font-weight: 500; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  font-size: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text-label);
  letter-spacing: 0.04em;
  font-family: var(--font-num);
  font-weight: 500;
}
.pill .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--positive); }

.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px 10px;
  font-size: 11px;
  color: var(--text-sub);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ja);
  transition: background 0.15s;
}
.theme-toggle:hover { background: var(--surface-highlight); }
.theme-toggle svg { width: 13px; height: 13px; }

/* ===== Section card ===== */
.section {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
  border-radius: 3px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  gap: 12px;
}
.section-head .title-wrap { display: flex; align-items: center; gap: 10px; }
.section-head .title-accent {
  width: 3px; height: 14px;
  background: var(--text);
}
.section-head h2 {
  font-size: 13px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
  letter-spacing: 0.02em;
}
.section-head .note {
  font-size: 10.5px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.section-body { padding: 16px; }

/* ===== KPI row ===== */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
  border-radius: 3px;
  overflow: hidden;
}
.kpi {
  padding: 16px 18px 14px;
  border-right: 1px solid var(--border-soft);
  position: relative;
  background: var(--surface);
}
.kpi:last-child { border-right: none; }
.kpi::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 2px;
  background: transparent;
}
.kpi.accent::before { background: var(--text); }
.kpi .kpi-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }
.kpi .label {
  font-size: 11px;
  color: var(--text-label);
  letter-spacing: 0.02em;
  font-weight: 500;
}
.kpi .idx {
  font-family: var(--font-num);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  padding: 1px 5px;
  border: 1px solid var(--border-soft);
}
.kpi .value {
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 6px;
  letter-spacing: -0.01em;
}
.kpi .value .unit {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
}
.kpi .delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-family: var(--font-num);
  color: var(--positive);
  margin-left: 6px;
  font-weight: 600;
}
.kpi .delta.neg { color: var(--negative); }
.kpi .footnote {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dotted var(--border-soft);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.kpi .spark-wrap { margin-top: 6px; }

/* ===== Insights ===== */
.insights {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--text-sub);
  border-radius: 3px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.insights::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--text);
}
.insights .ins-title {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.12em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.insights .ins-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-soft);
}
.insights-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 24px;
}
.ins-item {
  display: flex;
  gap: 10px;
  font-size: 11.5px;
  line-height: 1.6;
}
.ins-item .num-badge {
  flex-shrink: 0;
  width: 18px; height: 18px;
  background: var(--text);
  color: var(--surface);
  font-family: var(--font-num);
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.ins-item strong { color: var(--text); font-weight: 600; }

/* ===== Filter bar ===== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  margin-bottom: 16px;
  flex-wrap: wrap;
  border-radius: 3px;
  box-shadow: var(--shadow-card);
}
.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-label {
  font-size: 10.5px;
  color: var(--text-label);
  font-weight: 500;
  letter-spacing: 0.04em;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 11.5px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-sub);
  cursor: pointer;
  user-select: none;
  transition: all 0.12s;
  font-family: var(--font-ja);
}
.chip:hover { background: var(--surface-highlight); border-color: var(--border-strong); }
.chip.active {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}
.chip .count {
  font-size: 10px;
  opacity: 0.65;
  font-family: var(--font-num);
}

.search-input {
  padding: 5px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  width: 180px;
  font-family: var(--font-ja);
  color: var(--text);
  border-radius: 2px;
}
.search-input:focus { outline: 1px solid var(--text); outline-offset: -1px; }

.filter-reset {
  font-size: 11px;
  color: var(--link);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  text-decoration: underline;
  font-family: var(--font-ja);
}
.filter-reset:disabled { color: var(--text-muted); cursor: default; text-decoration: none; }

input[type=range] { accent-color: var(--text); }

/* ===== Grid (main content) ===== */
.grid-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.grid-main .full { grid-column: 1 / -1; }

/* ===== Ranking bars ===== */
.ranking-list { display: flex; flex-direction: column; }
.rank-row {
  display: grid;
  grid-template-columns: 28px 180px 1fr 100px 140px;
  align-items: center;
  gap: 10px;
  padding: 5px 6px;
  font-size: 12px;
  border-bottom: 1px dotted var(--border-soft);
  cursor: pointer;
  transition: background 0.1s;
}
.rank-row:hover { background: var(--surface-highlight); }
.rank-row.dimmed { opacity: 0.3; }
.rank-row.selected { background: var(--surface-highlight); }
.rank-row.selected .r-num { color: var(--text); font-weight: 700; }
.rank-row .r-num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  text-align: right;
  font-size: 11px;
  font-weight: 500;
}
.rank-row .r-name {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.rank-row .r-bar-wrap {
  position: relative;
  height: 18px;
  background: transparent;
}
.rank-row .r-bar {
  position: absolute;
  left: 0; top: 3px; bottom: 3px;
  background: var(--chart-neutral);
  transition: width 0.4s cubic-bezier(.2,.8,.2,1);
}
.rank-row .r-bar::after {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--chart-primary-soft);
  opacity: 0.5;
}
.rank-row.highlighted .r-bar,
.rank-row.selected .r-bar { background: var(--chart-primary); }
.rank-row.highlighted .r-bar::after,
.rank-row.selected .r-bar::after { background: var(--chart-accent); opacity: 1; }

/* 推定値の行：グレー濃淡のハッチのみで識別 */
.rank-row.estimated .r-bar {
  background: var(--chart-neutral-soft) !important;
  background-image: repeating-linear-gradient(-45deg, var(--chart-secondary) 0 1.5px, transparent 1.5px 5px) !important;
  opacity: 1;
}
.rank-row.estimated .r-bar::after { display: none; }
.rank-row.estimated .r-num { color: var(--text-muted); }
.rank-row.estimated .r-val .num { color: var(--text); }
.rank-row.estimated .r-name { color: var(--text-sub); }

.r-cat-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}
.est-mini {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 1px 4px;
  box-shadow: inset 0 0 0 1px var(--border);
  border-radius: 2px;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.4;
}
.rank-row .r-val {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--text);
  text-align: right;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.rank-row .r-val .suf { font-size: 10px; color: var(--text-muted); font-weight: 400; margin-left: 2px; }

.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  padding: 2px 7px;
  line-height: 1.4;
  font-weight: 500;
  text-align: center;
  letter-spacing: 0.02em;
  border-radius: 2px;
  white-space: nowrap;
  flex-shrink: 0;
}
.cat-badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.75;
}
.cat-badge.consul   { background: var(--cat-consul-bg);   color: var(--cat-consul-fg); }
.cat-badge.strategy { background: var(--cat-strategy-bg); color: var(--cat-strategy-fg); }
.cat-badge.sogo     { background: var(--cat-sogo-bg);     color: var(--cat-sogo-fg); }
.cat-badge.sier     { background: var(--cat-sier-bg);     color: var(--cat-sier-fg); }
.cat-badge.est {
  background: var(--surface);
  color: var(--text-muted);
  box-shadow: inset 0 0 0 1px var(--border);
}

/* 文中の「推定値」インラインバッジ */
.est-inline {
  display: inline-block;
  padding: 1px 6px;
  font-size: 10.5px;
  font-weight: 600;
  background: var(--surface);
  color: var(--text-sub);
  box-shadow: inset 0 0 0 1px var(--border);
  border-radius: 2px;
  letter-spacing: 0.04em;
  vertical-align: 1px;
}

/* ===== Chart SVG ===== */
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg .axis-line { stroke: var(--border); stroke-width: 1; }
.chart-svg .grid-line { stroke: var(--border-soft); stroke-width: 1; stroke-dasharray: 2 3; }
.chart-svg .grid-line.major { stroke: var(--border); stroke-dasharray: none; }
.chart-svg .axis-label {
  font-size: 10px;
  fill: var(--text-muted);
  font-family: var(--font-num);
}
.chart-svg .axis-title {
  font-size: 10px;
  fill: var(--text-label);
  font-family: var(--font-ja);
  font-weight: 500;
}
.chart-svg .dot { cursor: pointer; transition: all 0.15s; }
.chart-svg .dot-label {
  font-size: 9.5px;
  fill: var(--text-sub);
  font-family: var(--font-ja);
  pointer-events: none;
  font-weight: 500;
}
.chart-svg .avg-line { stroke: var(--chart-secondary); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-svg .quadrant-label {
  font-size: 9px;
  fill: var(--text-muted);
  font-family: var(--font-num);
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* ===== Histogram ===== */
.hist-chart { display: flex; flex-direction: column; gap: 4px; }
.hist-row {
  display: grid;
  grid-template-columns: 70px 1fr 44px;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  font-size: 11px;
}
.hist-row .hist-label { color: var(--text-label); font-family: var(--font-num); text-align: right; }
.hist-row .hist-bar-wrap {
  position: relative;
  height: 18px;
  background: var(--chart-neutral-soft);
  display: flex;
  overflow: hidden;
}
.hist-row .hist-seg {
  height: 100%;
  transition: width 0.3s;
  position: relative;
}
.hist-row .hist-seg.consul   { background: var(--cat-consul-dot); }
.hist-row .hist-seg.strategy { background: var(--cat-strategy-dot); }
.hist-row .hist-seg.sogo     { background: var(--cat-sogo-dot); }
.hist-row .hist-seg.sier     { background: var(--cat-sier-dot); }
.hist-row .hist-seg.est { background: var(--src-estimate) !important; opacity: 0.85; }
.hist-row .hist-seg.hl { outline: 2px solid var(--text); outline-offset: -2px; z-index: 2; }
.hist-row .hist-cnt { font-family: var(--font-num); color: var(--text); font-weight: 500; }
.hist-row .hist-cnt .suf { color: var(--text-muted); font-size: 10px; margin-left: 2px; }

/* ===== Legend ===== */
.legend-inline {
  display: flex;
  gap: 14px;
  font-size: 10.5px;
  color: var(--text-label);
  align-items: center;
  flex-wrap: wrap;
}
.legend-inline .sw {
  display: inline-block;
  width: 12px;
  height: 8px;
  margin-right: 5px;
  vertical-align: middle;
}
.legend-inline .sw.primary   { background: var(--chart-primary); }
.legend-inline .sw.secondary { background: var(--chart-secondary); }
.legend-inline .sw.neutral   { background: var(--chart-neutral); }
.legend-inline .sw.consul    { background: var(--cat-consul-dot); }
.legend-inline .sw.strategy  { background: var(--cat-strategy-dot); }
.legend-inline .sw.sogo      { background: var(--cat-sogo-dot); }
.legend-inline .sw.sier      { background: var(--cat-sier-dot); }
.legend-inline .sw.est-sw    { background: var(--src-estimate); }
.legend-inline .sw-ring-est {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--src-estimate);
  margin-right: 5px;
  vertical-align: middle;
}
.legend-inline .sw-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-inline .sw-dash {
  display: inline-block;
  width: 16px; height: 2px;
  margin-right: 5px;
  vertical-align: middle;
  background: var(--chart-secondary);
}

/* ===== Footer ===== */
.app-footer {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  font-size: 11px;
  color: var(--text-label);
  line-height: 1.7;
}
.app-footer h4 {
  font-size: 10px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text);
  letter-spacing: 0.14em;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-soft);
}
.app-footer a { color: var(--link); text-decoration: underline; }

/* ===== Tooltip ===== */
.tooltip {
  position: fixed;
  background: var(--text);
  color: var(--surface);
  font-size: 11px;
  padding: 8px 11px;
  pointer-events: none;
  z-index: 50;
  white-space: nowrap;
  line-height: 1.6;
  box-shadow: var(--shadow-elev);
  border-radius: 2px;
}
.tooltip .tt-title { font-weight: 600; margin-bottom: 3px; font-size: 12px; }
.tooltip .tt-row { color: var(--surface); opacity: 0.7; font-family: var(--font-num); }

/* ===== Detail pane ===== */
.detail-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 14px 16px;
  font-size: 12px;
  border-radius: 2px;
}
.detail-card .d-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; gap: 8px; }
.detail-card .d-name { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; letter-spacing: 0.01em; }
.detail-card .d-close { background: none; border: none; cursor: pointer; font-size: 18px; color: var(--text-muted); padding: 0 4px; line-height: 1; }
.detail-card .d-close:hover { color: var(--text); }
.detail-card .d-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.detail-card .d-row { display: flex; justify-content: space-between; border-bottom: 1px dotted var(--border-soft); padding: 5px 0; }
.detail-card .d-row .k { color: var(--text-label); font-size: 11px; }
.detail-card .d-row .v { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.detail-empty { padding: 28px 14px; text-align: center; color: var(--text-muted); font-size: 11px; background: var(--surface-alt); border: 1px dashed var(--border); line-height: 1.8; border-radius: 2px; }
.detail-empty .big { font-size: 22px; display: block; margin-bottom: 6px; font-family: var(--font-num); color: var(--border-strong); font-weight: 300; }

/* ===== Tweaks panel ===== */
.tweaks {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-elev);
  font-size: 12px;
  z-index: 100;
  display: none;
  border-radius: 3px;
}
.tweaks.visible { display: block; }
.tweaks-head { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); display: flex; justify-content: space-between; align-items: center; }
.tweaks-head h3 { font-size: 11px; margin: 0; font-weight: 700; letter-spacing: 0.14em; color: var(--text); }
.tweaks-body { padding: 12px; }
.tweaks-row { margin-bottom: 12px; }
.tweaks-row:last-child { margin-bottom: 0; }
.tweaks-row label { display: block; font-size: 10.5px; color: var(--text-label); margin-bottom: 5px; letter-spacing: 0.02em; }
.tweaks-row .seg { display: flex; border: 1px solid var(--border); border-radius: 2px; overflow: hidden; }
.tweaks-row .seg button {
  flex: 1; border: none; background: var(--surface); padding: 5px 6px; font-size: 11px;
  cursor: pointer; color: var(--text-sub); border-right: 1px solid var(--border);
  font-family: var(--font-ja);
  transition: background 0.1s;
}
.tweaks-row .seg button:last-child { border-right: none; }
.tweaks-row .seg button:hover { background: var(--surface-highlight); }
.tweaks-row .seg button.on { background: var(--text); color: var(--surface); }

/* ===== Sparkline ===== */
.sparkline { display: block; }
