[hidden] { display: none !important; }
:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #16191d;
  --ink-2: #4a525c;
  --ink-3: #7c8591;
  --line: #e3e6ea;
  --line-2: #d0d5db;
  --accent: #156082;
  --accent-ink: #ffffff;
  --accent-soft: #e6f0f5;
  --select: #e97132;
  --danger: #b42318;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .08);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body { font: 13px/1.45 var(--font); display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { stroke-linecap: round; stroke-linejoin: round; }

/* ---- barra superior ---- */
.bar { display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; }
.brand em { font-style: normal; font-weight: 500; color: var(--ink-3); }
.logo { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(180deg, var(--accent) 0 45%, #e97132 45% 70%, #196b24 70%); }
.kinds { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; padding: 4px; background: var(--bg); border-radius: 9px; }
.kinds button { display: grid; place-items: center; width: 34px; height: 30px; border: 0; border-radius: 7px; background: none; cursor: pointer; color: var(--ink-2); flex: none; }
.kinds button svg { width: 20px; height: 20px; }
.kinds button:hover { background: var(--surface); color: var(--ink); }
.kinds button.on { background: var(--surface); color: var(--accent); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.spacer { flex: 1; }
button { cursor: pointer; }
.icon { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--ink-2); }
.icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.icon:hover:not(:disabled) { background: var(--bg); color: var(--ink); }
.icon:disabled { opacity: .35; cursor: default; }
.primary, .tab button, .row-end button, .menu-wrap > button { height: 32px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 500; }
.primary, .row-end .primary, .menu-wrap > .primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.primary:hover { filter: brightness(1.08); }
.menu-wrap { position: relative; }
.popover { position: absolute; z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; }
#export-menu { right: 0; top: 38px; display: flex; flex-direction: column; min-width: 200px; }
#export-menu button { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; height: auto; }
#export-menu button:hover { background: var(--bg); }

/* ---- escenario ---- */
main { flex: 1; display: flex; min-height: 0; }
#stage { flex: 1; position: relative; overflow: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 24px 24px;
  background-image: radial-gradient(#dfe3e8 1px, transparent 1px); background-size: 18px 18px; }
#slide { position: relative; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); padding: 20px; }
#chart svg { display: block; }
#chart [data-key] { cursor: pointer; }
#chart [data-key]:hover { filter: brightness(1.12) saturate(1.05); }
#chart [data-key].sel { filter: drop-shadow(0 0 0.6px var(--select)) drop-shadow(0 0 0.6px var(--select)); }
#overlay { position: absolute; left: 20px; top: 20px; pointer-events: none; overflow: visible; }
#overlay .box { fill: none; stroke: var(--select); stroke-width: 1.25; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
#overlay .handle { fill: #fff; stroke: var(--select); stroke-width: 2; pointer-events: all; cursor: grab; vector-effect: non-scaling-stroke; }
#overlay .handle:hover { fill: var(--select); }
#overlay .target { fill: var(--select); opacity: .25; }
#overlay .target.near { opacity: 1; }
#overlay .guide { font: 600 11px var(--font); fill: var(--select); paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.tip { color: var(--ink-3); font-size: 12px; text-align: center; max-width: 620px; margin: 18px 0 0; }
#toast { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); margin: 0; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; box-shadow: var(--shadow); font-weight: 500; }
#toast.error { background: var(--danger); }

/* ---- barra flotante (como la de PowerPoint) ---- */
.mini { position: absolute; z-index: 20; display: flex; align-items: center; gap: 4px; padding: 5px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); max-width: calc(100% - 32px); flex-wrap: wrap; }
.mini .sep { width: 1px; align-self: stretch; background: var(--line); margin: 2px 2px; }
.mini button, .mini select { height: 28px; border: 1px solid transparent; border-radius: 6px; background: none; padding: 0 8px; font-size: 12px; white-space: nowrap; }
.mini select { border-color: var(--line); background: var(--surface); padding-right: 4px; max-width: 170px; }
.mini button:hover { background: var(--bg); }
.mini button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.mini .swatch-btn { display: flex; align-items: center; gap: 6px; }

/* ---- panel lateral ---- */
#side { width: 340px; flex: none; background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 8px 10px 10px; color: var(--ink-3); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab { flex: 1; overflow: auto; padding: 16px; }
.selection { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.sel-kind { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--select); }
.sel-title { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.link { border: 0; background: none; color: var(--accent); font-weight: 500; padding: 2px 0; cursor: pointer; }
.group h4, .tab h4 { margin: 18px 0 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.item { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 34px; }
.item > span { color: var(--ink-2); }
.item select, .item input[type=text], .item input[type=number], .tab input[type=number] { height: 30px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--surface); padding: 0 8px; min-width: 0; }
.item select { max-width: 180px; }
.item input[type=text] { width: 150px; }
.note { color: var(--ink-3); font-size: 12px; background: var(--bg); border-radius: 8px; padding: 8px 10px; margin: 6px 0; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.actions button { height: 30px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 500; }
.actions button:hover { border-color: var(--accent); color: var(--accent); }
.actions button.danger:hover { border-color: var(--danger); color: var(--danger); }
/* interruptor */
.switch { position: relative; width: 34px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; position: absolute; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 20px; transition: background .15s; }
.switch span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(14px); }
/* colores */
.swatch { width: 18px; height: 18px; border-radius: 5px; border: 1px solid rgba(0,0,0,.12); flex: none; }
.swatch.auto { background: conic-gradient(#156082 0 25%, #e97132 0 50%, #196b24 0 75%, #0f9ed5 0); }
.swatch.none { background: linear-gradient(135deg, #fff 45%, #d92d20 45% 55%, #fff 55%); }
.color-btn { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--surface); }
.color-pop { width: 252px; padding: 10px; }
.color-pop .grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.color-pop .grid button { width: 24px; height: 24px; border-radius: 6px; border: 1px solid rgba(0,0,0,.12); padding: 0; }
.color-pop .grid button:hover { transform: scale(1.12); }
.color-pop .grid .br { grid-column: 1 / -1; height: 0; border: 0; }
.color-pop .opt { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 6px 4px; border-radius: 6px; text-align: left; }
.color-pop .opt:hover { background: var(--bg); }
.color-pop .custom { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--ink-2); }
.color-pop input[type=color] { width: 34px; height: 26px; border: 1px solid var(--line-2); border-radius: 6px; padding: 0; background: none; }
/* datos y avanzado */
textarea { width: 100%; height: 240px; border: 1px solid var(--line-2); border-radius: 8px; padding: 10px; font: 12px/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; white-space: pre; resize: vertical; }
.hint { color: var(--ink-3); font-size: 12px; margin: 0 0 10px; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.pair { display: flex; align-items: center; gap: 12px; }
.pair label { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.pair input { width: 80px; }
#filter { width: 100%; height: 34px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 10px; margin-bottom: 10px; }
details { border-bottom: 1px solid var(--line); }
summary { cursor: pointer; font-weight: 600; padding: 10px 0; }
.field { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 3px 0; }
.field label { color: var(--ink-2); }
.field select, .field input[type=text], .field input[type=number] { height: 28px; border: 1px solid var(--line-2); border-radius: 6px; padding: 0 6px; max-width: 160px; background: var(--surface); }
.field input[type=number] { width: 90px; }

@media (max-width: 900px) {
  main { flex-direction: column; }
  #side { width: 100%; border-left: 0; border-top: 1px solid var(--line); max-height: 50vh; }
  #stage { padding: 56px 12px 12px; }
  .brand em { display: none; }
}
