:root {
  --bg: #fdfdfc;
  --surface: #ffffff;
  --ink: #121212;
  --muted: #666666;
  --border: #e0e0e0;
  --accent: #004d40;
  --accent-soft: #e0f2f1;
  --warn: #d32f2f;
  --vetting: #fff9c4;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --radius: 8px;
}

* { box-sizing: border-box; }

body.editorial-theme {
  margin: 0;
  font-family: "Space Grotesk", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Typography */
h1, h2, h3 { font-family: "IBM Plex Serif", serif; font-weight: 600; margin: 0; }

/* Navigation */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 0.75rem; }
.brand .logo { font-size: 1.5rem; color: var(--accent); }
.brand h1 { font-size: 1.1rem; }
.brand h1 span { color: var(--muted); font-weight: 400; font-family: "Space Grotesk", sans-serif; font-size: 0.9rem; margin-left: 0.5rem; }

.nav-stats { display: flex; gap: 1.5rem; }
.stat-item { display: flex; flex-direction: column; align-items: center; }
.stat-item .label { font-size: 0.65rem; text-transform: uppercase; color: var(--muted); letter-spacing: 0.05em; }
.stat-item .val { font-weight: 700; font-size: 1.1rem; }

.stat-divider { width: 1px; height: 2rem; background: var(--border); margin: 0 0.5rem; align-self: center; }
.stat-item.performance .val { font-family: "IBM Plex Mono", monospace; color: var(--accent); }
.delta-inline { font-size: 0.75rem; font-weight: 700; margin-left: 0.3rem; padding: 0.1rem 0.3rem; border-radius: 4px; vertical-align: middle; }
.delta-inline.plus { color: #2e7d32; background: #e8f5e9; }
.delta-inline.plus::before { content: "▲ "; }

.btn-icon { background: none; border: none; font-size: 1.2rem; cursor: pointer; padding: 0.5rem; border-radius: 50%; transition: background 0.2s; }
.btn-icon:hover { background: var(--accent-soft); }
.btn-icon:disabled { opacity: 0.5; cursor: default; }

/* Stats Update Banner */
.stats-update-banner {
  background: #fff8e1;
  border-bottom: 1px solid #ffe082;
  padding: 0.5rem 1.5rem;
}

.banner-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: #856404;
}

.banner-content .icon { font-size: 1.1rem; }

.btn-banner-action {
  background: #ffc107;
  border: 1px solid #ffb300;
  color: #212529;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-banner-action:hover {
  background: #ffca28;
  transform: translateY(-1px);
}

.btn-banner-action:active {
  transform: translateY(0);
}

/* Pipeline Board */
.board-controls {
  display: flex;
  align-items: center;
...
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.pipeline-board {
  display: flex;
  flex: 1;
  overflow-x: auto;
  padding: 1.5rem;
  gap: 1rem;
  background: #f4f4f2;
}

.stage-col {
  min-width: 300px;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stage-col header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.5rem;
}

.stage-col header h2 { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); flex: 1; }
.stage-col .count { font-size: 0.8rem; font-weight: 700; background: var(--border); padding: 0.1rem 0.5rem; border-radius: 99px; }
.stage-col .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }

/* Column Specifics */
[data-stage="draft"] header h2 { color: var(--accent); }
[data-stage="draft"] .dot { background: var(--accent); }
[data-stage="draft"].active-stage { background: rgba(0, 77, 64, 0.03); border-radius: var(--radius); }

.card-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-bottom: 2rem;
}

/* Article Card */
.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  position: relative;
}

.article-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent); }

.article-card h3 { font-size: 1rem; line-height: 1.3; margin-bottom: 0.5rem; }
.article-card .meta { font-size: 0.75rem; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.article-card .attention-chip {
  display: inline-block;
  margin-top: 0.45rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: #8d6e00;
  background: #fff8d6;
  border: 1px solid #f0df8a;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}
.card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}
.btn-quick {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.45rem;
  cursor: pointer;
}

.badge-lang { font-size: 0.6rem; font-weight: 700; padding: 0.1rem 0.3rem; border-radius: 3px; border: 1px solid var(--border); }
.badge-lang.jp { background: #fff5f5; color: #c53030; border-color: #feb2b2; }
.badge-lang.en { background: #f0fff4; color: #276749; border-color: #9ae6b4; }

.vet-indicator {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--vetting);
  border: 1px solid #fbc02d;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Inspector Overlay */
.inspector-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.inspector-panel {
  background: var(--bg);
  width: 90%;
  max-width: 1200px;
  height: 85vh;
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.inspector-header {
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.inspector-meta { display: flex; align-items: center; gap: 1rem; }
.inspector-meta h2 { font-size: 1.25rem; }
.badge-status { font-size: 0.75rem; font-weight: 700; background: var(--accent); color: white; padding: 0.2rem 0.6rem; border-radius: 4px; text-transform: uppercase; }

.close-btn { background: none; border: none; font-size: 2rem; cursor: pointer; color: var(--muted); }

.inspector-layout { display: flex; flex: 1; overflow: hidden; }

.inspector-content { flex: 1; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; padding: 1.5rem; }

.content-tabs { display: flex; gap: 1.5rem; padding: 0 1.5rem; border-bottom: 1px solid var(--border); }
.tab-btn { background: none; border: none; padding: 1rem 0; font-weight: 600; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; transition: all 0.2s; }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-pane { flex: 1; overflow-y: auto; display: none; }
.tab-pane.active { display: block; }

.markdown-body {
  font-family: "IBM Plex Serif", serif;
  line-height: 1.6;
  font-size: 1.1rem;
  color: #333;
}
.markdown-body h1, .markdown-body h2, .markdown-body h3 { margin-top: 1.5rem; margin-bottom: 1rem; }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

.inspector-sidebar { width: 320px; padding: 1.5rem; display: flex; flex-direction: column; gap: 1.5rem; background: #f9f9f7; }

.next-step-card { background: var(--surface); border: 1px solid var(--border); padding: 1rem; border-radius: var(--radius); }
.next-step-card h3 { font-size: 0.75rem; text-transform: uppercase; color: var(--muted); margin-bottom: 0.5rem; }
.next-step-card p { font-weight: 700; font-size: 1.1rem; margin: 0 0 1rem 0; color: var(--accent); }

.command-block { position: relative; background: #1a1a1a; color: #eee; padding: 0.75rem; border-radius: 6px; font-family: "IBM Plex Mono", monospace; font-size: 0.8rem; }
.command-block code { word-break: break-all; }
.copy-cmd { position: absolute; bottom: 5px; right: 5px; background: var(--accent); color: white; border: none; font-size: 0.6rem; padding: 0.2rem 0.4rem; border-radius: 3px; cursor: pointer; }

.workflow-actions { display: flex; flex-direction: column; gap: 0.75rem; }
.workflow-actions button { padding: 0.75rem; border-radius: var(--radius); border: 1px solid transparent; font-weight: 700; cursor: pointer; transition: all 0.2s; }

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { filter: brightness(1.2); }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--ink); }
.btn-danger { background: none; color: var(--warn); border-color: var(--warn); }
.btn-danger:hover { background: #fff5f5; }

.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 1rem; }
.asset-item img { width: 100%; height: 100px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); }

/* Analytics Table */
.stats-table-container { 
  background: var(--surface); 
  border-radius: 8px; 
  border: 1px solid var(--border); 
  overflow: hidden; 
  margin-top: 1rem;
}
.stats-table { 
  width: 100%; 
  border-collapse: collapse; 
  font-size: 0.9rem; 
}
.stats-table th, .stats-table td { 
  padding: 1rem; 
  text-align: left; 
  border-bottom: 1px solid var(--border); 
}
.stats-table th { 
  background: #f9f9f7; 
  font-weight: 700; 
  color: var(--muted); 
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}
.stats-table th.sortable { cursor: pointer; user-select: none; }
.stats-table th.sortable:hover { color: var(--accent); }
.stats-table tr:last-child td { border-bottom: none; }
.stats-table td { font-family: "Space Grotesk", sans-serif; }
.stats-table td.numeric { 
  font-family: "IBM Plex Mono", monospace; 
  font-weight: 500; 
  text-align: right; 
}
.stats-table .timestamp {
  font-size: 0.75rem;
  color: var(--muted);
}

/* Growth Summary Cards */
.growth-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.growth-card { background: var(--surface); border: 1px solid var(--border); padding: 1.25rem; border-radius: 8px; }
.growth-card .label { font-size: 0.7rem; text-transform: uppercase; color: var(--muted); letter-spacing: 0.05em; font-weight: 700; }
.growth-card .value-row { display: flex; align-items: baseline; gap: 0.75rem; margin-top: 0.5rem; }
.growth-card .val { font-size: 1.75rem; font-weight: 700; font-family: "IBM Plex Mono", monospace; color: var(--accent); }
.growth-card .delta { font-size: 0.85rem; font-weight: 600; padding: 0.1rem 0.4rem; border-radius: 4px; }
.growth-card .delta.plus { color: #2e7d32; background: #e8f5e9; }
.growth-card .delta.plus::before { content: "▲ "; }
.growth-card .delta.zero { display: none; }

.delta-small {
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 0.4rem;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  vertical-align: middle;
}
.delta-small.plus {
  color: #2e7d32;
  background: #e8f5e9;
}
.delta-small.plus::before {
  content: "▲";
  margin-right: 1px;
}
/* Chart Styling */
.chart-controls {
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chart-controls .control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.chart-controls label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
}
.input-select {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text);
  outline: none;
}
.input-select:focus {
  border-color: var(--primary);
}

.chart-wrapper { 
  background: var(--surface); 
  border: 1px solid var(--border); 
  border-radius: 8px; 
  padding: 1.5rem; 
  margin-bottom: 2rem; 
  height: 320px;
}

.focus-state { margin-bottom: 0.75rem; }
.focus-badge {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid #b2dfdb;
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.top-movers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.mover-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem;
}
.mover-card .mover-title { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.mover-card .mover-article { margin: 0.4rem 0; font-size: 0.9rem; font-weight: 600; }
.mover-card .mover-delta { font-size: 0.85rem; font-weight: 700; color: #2e7d32; }
.mover-card .mover-action {
  margin-top: 0.5rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-size: 0.75rem;
}

.table-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.input-text {
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  min-width: 260px;
}
.input-check { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.82rem; color: var(--muted); }

.toast-container {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  background: #1f2937;
  color: #fff;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  font-size: 0.82rem;
  box-shadow: var(--shadow);
}
.toast.success { background: #1f5134; }
.toast.error { background: #7f1d1d; }
