
:root {
  --bg: #f9fafb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --grid: #e5e7eb;
  --pos: #16a34a;
  --neg: #ef4444;
  --line: #111827;
  --shadow: 0 10px 25px rgba(0,0,0,.06);
  --radius: 16px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
}
.container { max-width: 1200px; margin: 0 auto; padding: 32px 20px 80px; }
header { margin-bottom: 24px; }
h1 {
  font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 6px;
}
.subtitle { color: var(--muted); font-size: 14px; }
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.kpis .card { display:flex; flex-direction:column; gap:8px; }
.kpi-label { color: var(--muted); font-size:12px; text-transform:uppercase; letter-spacing:.08em; }
.kpi-value { font-size:22px; font-weight:800; }
.section-title { font-size:16px; font-weight:700; margin: 0 0 12px; }
.canvas-wrap { position: relative; width: 100%; height: 360px; }
svg { width: 100%; height: 100%; display: block; }
.legend { display:flex; flex-wrap:wrap; gap:8px; margin-top: 8px; }
.legend .item { display:flex; align-items:center; gap:6px; font-size:12px; color: var(--muted); }
.swatch { width:12px; height:12px; border-radius:3px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.table { width:100%; border-collapse: collapse; font-size: 14px;}
.table th, .table td { padding: 10px 12px; text-align: right; border-bottom: 1px solid #eee; }
.table th:first-child, .table td:first-child { text-align: left; }
.table th { color: var(--muted); font-weight:600; background:#fafafa; }
.narrative { line-height:1.6; font-size: 15px; }
.narrative[contenteditable="true"] { outline: none; border: 1px dashed #e5e7eb; padding: 12px; border-radius: 10px; background: #fff; }
.toolbar { display:flex; gap:10px; align-items:center; justify-content: flex-end; margin-top: 8px; }
.btn {
  background: var(--accent); color:#fff; border:none; padding:10px 14px; border-radius:10px;
  font-weight:600; cursor:pointer; box-shadow: var(--shadow);
}
.btn.secondary { background:#e5e7eb; color:#111827; }
.select { padding: 8px 10px; border-radius: 8px; border: 1px solid #e5e7eb; background:#fff; }
.footer { color: var(--muted); font-size: 12px; margin-top: 18px; }
.axis text { fill: #6b7280; font-size: 11px; }
.axis path, .axis line { stroke: #d1d5db; }
.tooltip {
  position: absolute; pointer-events: none; background: #111827; color:#fff; padding: 6px 8px;
  font-size: 12px; border-radius: 6px; box-shadow: var(--shadow); opacity: 0; transform: translate(-50%, -120%);
}
