:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #21253a;
  --border: #2d3148;
  --text: #e2e4ed;
  --muted: #8b8fa8;
  --accent: #4f8ef7;
  --accent-dim: #1e2d52;
  --green: #3ecf8e;
  --green-dim: #0d2b1e;
  --red: #f66;
  --red-dim: #2b1313;
  --yellow: #f5a623;
  --yellow-dim: #2b2010;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SF Mono", "Fira Code", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
}

.sidebar-logo {
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.sidebar-logo .brand { font-weight: 700; font-size: 15px; color: var(--text); }
.sidebar-logo .sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--muted);
  font-size: 13px;
  transition: background 0.15s, color 0.15s;
  border-left: 2px solid transparent;
}
.nav-item:hover { color: var(--text); background: var(--surface2); text-decoration: none; }
.nav-item.active { color: var(--accent); border-left-color: var(--accent); background: var(--accent-dim); }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.main { margin-left: 200px; flex: 1; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar h1 { font-size: 18px; font-weight: 600; }
.topbar .meta { font-size: 12px; color: var(--muted); }

.content { padding: 28px 32px; max-width: 1200px; }

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.stat-value { font-size: 28px; font-weight: 700; color: var(--accent); line-height: 1; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body { padding: 20px; }

/* Tables */
.table-meta { padding: 10px 12px 0; font-size: 12px; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  padding: 10px 12px;
  color: var(--muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

/* Compact table variant — tighter rows, middle-aligned */
.table-compact td { padding: 6px 12px; vertical-align: middle; }
.table-compact th { padding: 8px 12px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-green   { background: var(--green-dim);  color: var(--green); }
.badge-red     { background: var(--red-dim);    color: var(--red); }
.badge-yellow  { background: var(--yellow-dim); color: var(--yellow); }
.badge-blue    { background: var(--accent-dim); color: var(--accent); }
.badge-muted   { background: var(--surface2);   color: var(--muted); }
.badge-purple  { background: #1e1432; color: #c084fc; }
.badge-teal    { background: #0d2b29; color: #2dd4bf; }
.badge-amber   { background: #2b1f0a; color: #fbbf24; }
.badge-orange  { background: #2b1408; color: #fb923c; }
.badge-slate   { background: var(--surface2); color: var(--muted); }
.badge-emerald { background: var(--green-dim); color: var(--green); }
.badge-cyan    { background: #0d2530; color: #22d3ee; }
.badge-indigo  { background: #1e1b4b; color: #a5b4fc; }

/* Demands list */
.demands { list-style: none; }
.demands li {
  font-size: 12px;
  color: var(--muted);
  padding: 1px 0;
}
.demands li::before { content: "›  "; color: var(--accent); }

/* Forms / search */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
input[type="text"], select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  font-family: var(--font);
}
input[type="text"]:focus, select:focus { border-color: var(--accent); }
input[type="text"] { min-width: 220px; }
label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; cursor: pointer; }
input[type="checkbox"] { accent-color: var(--accent); cursor: pointer; }

button, .btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font);
  text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { opacity: 0.85; text-decoration: none; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-filter {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  padding: 6px 12px;
}
.btn-filter:hover { border-color: var(--yellow); color: var(--yellow); }
.btn-filter-active {
  background: rgba(245,166,35,0.12);
  border: 1px solid rgba(245,166,35,0.5);
  color: var(--yellow);
  font-size: 12px;
  padding: 6px 12px;
}
.btn-filter-active:hover { opacity: 0.8; }

/* Pagination */
.pagination { display: flex; gap: 8px; align-items: center; margin-top: 20px; }
.pagination .page-info { color: var(--muted); font-size: 12px; }

/* Digest markdown */
.digest-body { line-height: 1.8; }
.digest-body h1 { font-size: 20px; margin: 0 0 4px; }
.digest-body h2 { font-size: 15px; margin: 20px 0 10px; color: var(--accent); border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.digest-body h3 { font-size: 13px; margin: 14px 0 6px; }
.digest-body p { margin: 8px 0; color: var(--muted); font-size: 13px; }
.digest-body ul { padding-left: 0; list-style: none; }
.digest-body ul li {
  padding: 8px 12px;
  border-left: 2px solid var(--border);
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.6;
}
.digest-body ul li strong { color: var(--text); }
.digest-body hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.digest-body em { color: var(--muted); font-size: 12px; }

/* Digest list item */
.digest-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.digest-row:last-child { border-bottom: none; }
.digest-row:hover { background: var(--surface2); }
.digest-date { font-weight: 600; font-size: 14px; }
.digest-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Campaign cards */
.campaign-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.campaign-header {
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}
.campaign-header:hover { background: var(--surface2); }
.campaign-chevron { flex-shrink: 0; color: var(--muted); transition: transform 0.2s; margin-top: 2px; }
.campaign-header.open .campaign-chevron { transform: rotate(90deg); }
.campaign-name { font-weight: 700; font-size: 15px; }
.campaign-summary { font-size: 12px; color: var(--muted); margin-top: 4px; }
.campaign-targets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.target-chip {
  display: inline-block;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
}
a.target-chip:hover {
  border-color: var(--accent);
  color: var(--text);
  cursor: pointer;
}
/* Active position — blue border/tint to signal an open capital block */
a.target-chip.target-chip--active {
  background: rgba(79, 142, 247, 0.08);
  border-color: rgba(79, 142, 247, 0.4);
  color: var(--accent);
  font-weight: 500;
}
a.target-chip.target-chip--active:hover {
  background: rgba(79, 142, 247, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}
/* Closed / exited position — muted, struck-through */
.target-chip.target-chip--closed {
  opacity: 0.55;
  text-decoration: line-through;
  color: var(--muted);
}
a.target-chip.target-chip--closed:hover {
  border-color: var(--border);
  color: var(--muted);
  text-decoration: line-through;
}
.campaign-body { border-top: 1px solid var(--border); display: none; }
.campaign-body.open { display: block; }
.campaign-body table td, .campaign-body table th { padding: 8px 12px; }

/* Company detail */
.company-header { margin-bottom: 24px; }
.company-header h2 { font-size: 22px; font-weight: 700; }
.company-header .ticker-badge {
  display: inline-block;
  background: var(--accent-dim);
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  padding: 3px 10px;
  border-radius: 4px;
  margin-right: 10px;
  vertical-align: middle;
}
.company-meta { color: var(--muted); font-size: 13px; margin-top: 6px; }

/* Section heading */
.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  border-left: 3px solid var(--accent);
  padding-left: 10px;
  margin: 32px 0 14px;
}
.section-title:first-child { margin-top: 0; }

.section-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 7px;
  margin-left: 6px;
  vertical-align: middle;
}

.section-date {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  margin-left: 8px;
  vertical-align: middle;
}

/* Ticker mono */
.ticker { font-family: var(--mono); font-size: 12px; color: var(--accent); font-weight: 600; }

/* Utility */
.muted { color: var(--muted); }
.text-right { text-align: right; }
.mt8 { margin-top: 8px; }
.gap { display: flex; gap: 8px; align-items: center; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* ── Company Hero ─────────────────────────────────────────── */
.co-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.co-hero-left { flex: 1; min-width: 0; }
.co-identity {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 6px;
}
.co-name {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: break-word;
  word-break: break-word;
}
.co-jp {
  font-size: 13px;
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.co-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.co-sep { opacity: 0.4; margin: 0 2px; }

/* About toggle */
.about-toggle { margin-top: 8px; }
.about-body {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
  max-width: 860px;
}
.about-clamped {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.about-more-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  padding: 2px 0;
  cursor: pointer;
  margin-top: 2px;
}
.about-more-btn:hover { opacity: 0.8; }

/* ── Stat Rail ────────────────────────────────────────────── */
.stat-rail {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
}
.stat-item {
  padding: 8px 14px;
  border-right: 1px solid var(--border);
  min-width: 0;
}
.stat-item:last-child { border-right: none; }
.stat-item-sep { border-left: 2px solid rgba(79,142,247,0.35); }
.stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 4px;
  white-space: nowrap;
}
.stat-value {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.2;
}
.stat-nil { color: var(--muted) !important; }
.stat-item-amber {
  border-color: rgba(217,119,6,0.4) !important;
  background: rgba(120,53,15,0.08);
  position: relative;
}
.stat-item-amber .stat-mandate-badge {
  position: absolute;
  top: 5px;
  right: 6px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fbbf24;
  background: rgba(120,53,15,0.55);
  border: 1px solid rgba(217,119,6,0.45);
  border-radius: 3px;
  padding: 1px 4px;
  white-space: nowrap;
  line-height: 1.4;
  cursor: help;
}

/* ── Page-level tabs (pill style) ────────────────────────── */
.page-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.page-tab {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  padding: 7px 18px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.page-tab:hover { border-color: var(--accent); color: var(--text); background: var(--surface2); opacity: 1; }
.page-tab.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* ── Financial sub-tabs (pill style, sticky) ─────────────── */
.fin-tabs {
  display: flex;
  gap: 4px;
  padding: 4px 0 10px;
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
  border-bottom: 1px solid var(--border);
}
.fin-tab {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  padding: 6px 14px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.fin-tab:hover { color: var(--text); background: var(--surface2); border-color: var(--border); opacity: 1; }
.fin-tab.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* Chart + table unified card */
.chart-toggle-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  font-size: 11px;
  cursor: pointer;
  padding: 3px 10px;
  white-space: nowrap;
}
.chart-toggle-btn:hover { background: rgba(255,255,255,0.11); }
.chart-toggle-btn .chevron { font-style: normal; }
.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

/* Source badges in fin table headers */
.src-badge { font-size: 9px; font-weight: 400; border-radius: 3px; padding: 1px 5px; }
.src-est    { background: rgba(245,166,35,0.18);  color: #f5a623; }
.src-tdnet  { background: rgba(62,207,142,0.15);  color: var(--green); }
.src-edinet { background: rgba(139,143,168,0.15); color: var(--muted); }

/* Zebra striping on financial tables */
.fin-table tbody tr:nth-child(even) td { background: rgba(255,255,255,0.018); }

/* Empty state */
.empty-state {
  font-size: 13px;
  color: var(--muted);
  padding: 48px 0;
  text-align: center;
}

/* Shareholder history — tier overview */
.tier-overview { padding: 16px 20px 0; border-bottom: 1px solid var(--border); }
.tier-cards { display: flex; gap: 12px; margin-bottom: 14px; }
.tier-card { flex: 1; padding: 12px 14px 10px; background: var(--surface, var(--bg)); border-radius: 6px; border: 1px solid var(--border); }
.tier-card__label { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; }
.tier-card__value { font-size: 22px; font-weight: 700; font-family: var(--mono); line-height: 1.1; margin-bottom: 3px; }
.tier-card__delta { font-size: 11px; font-family: var(--mono); margin-bottom: 6px; }
.tier-card__desc { font-size: 10px; color: var(--muted); line-height: 1.4; }
.tier-bar-wrap { padding-bottom: 14px; }
.tier-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--border); gap: 0; }
.tier-bar__seg { height: 100%; transition: width .3s ease; }
.tier-bar-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 7px; font-size: 11px; color: var(--muted); }
.tier-toggle-btn { font-size: 11px; padding: 3px 10px; border-radius: 4px; border: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer; transition: background .15s; }
.tier-toggle-btn:hover { background: var(--border); }

/* Cross-Holdings multi-year table */
.cross-summary { display:flex; gap:24px; padding:16px 20px 14px; border-bottom:1px solid var(--border); flex-wrap:wrap; }
.cross-summary__item { display:flex; flex-direction:column; gap:3px; align-items:center; }
.cross-summary__label { font-size:10px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); }
.cross-summary__value { font-size:20px; font-weight:700; font-family:var(--mono); line-height:1.1; }
.cross-summary__delta { font-size:11px; font-family:var(--mono); margin-top:1px; }
.delta-down { color:var(--green); }
.delta-up   { color:var(--red); }

.cross-table { width:100%; border-collapse:collapse; }
.cross-table th, .cross-table td { padding:6px 10px; border-bottom:1px solid var(--border); }
.cross-yr-hd { text-align:center; font-size:12px; font-weight:600; background:var(--surface2); border-left:1px solid var(--border); padding:7px 10px 4px; }
.cross-yr-total { display:block; font-size:10px; font-weight:400; color:var(--muted); margin-top:1px; }
.cross-subhd th { background:var(--bg); position:sticky; top:0; }
.cross-name { font-size:12px; min-width:160px; max-width:240px; }
.cross-name__link { color:var(--text); text-decoration:none; }
.cross-name__link:hover { color:var(--accent); }
.cross-name__en { font-size:10px; color:var(--muted); margin-top:1px; }
.cross-cell { text-align:right; font-family:var(--mono); font-size:12px; white-space:nowrap; }
.cross-cell--bv  { border-left:1px solid var(--border); padding-left:12px; }
.cross-cell--sh  { color:var(--muted); font-size:11px; }
.cross-cell--empty { text-align:center; color:var(--muted); border-left:1px solid var(--border); }
.cross-cell--down     { color:var(--green); }
.cross-cell--up       { color:var(--red); }
.cross-cell--bv-bold  { color:var(--green); font-weight:700; }
.cross-row--exited td { opacity:.45; }
.cross-row--exited .cross-name { text-decoration:line-through; }
.cross-row--total td { border-top:2px solid var(--border); border-bottom:none; background:var(--surface2); }
.cross-delta       { font-family:var(--mono); font-size:11px; }
.cross-delta--down { color:var(--green); }
.cross-delta--up   { color:var(--red); }
.cross-delta--flat { color:var(--muted); }
.cross-delta--new  { color:var(--accent); font-weight:600; }

/* Shareholder history pivot table */
.sh-chart-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 20px 0; }
.sh-chart-container { height: 240px; padding: 8px 20px 12px; border-bottom: 1px solid var(--border); }
.shareholder-history-table { width: 100%; border-collapse: collapse; }
.shareholder-history-table th,
.shareholder-history-table td { padding: 7px 12px; border-bottom: 1px solid var(--border); }
.shareholder-history-table thead th { font-size: 11px; color: var(--muted); font-weight: 500; background: var(--bg); position: sticky; top: 0; }
.shareholder-history-table thead th:not(:first-child) { text-align: right; }
.shareholder-history-table thead th:nth-child(3) { text-align: center; }
.sh-new td:first-child { border-left: 2px solid #60a5fa; }
.sh-new { background: rgba(96,165,250,0.04); }
.sh-exit { opacity: 0.5; }
.sh-absent { color: var(--muted); }
.hhi-row td { font-variant-numeric: tabular-nums; border-top: 2px solid var(--border); border-bottom: none; }
.hhi-row td:not(:first-child) { text-align: right; font-family: var(--mono); color: var(--muted); }
.hhi-high { color: #fbbf24 !important; }
