:root {
  --bg: #f2f2f4;
  --panel: #ffffff;
  --line: #e3e3e8;
  --line-strong: #d0d0d8;
  --text: #1c1c1e;
  --muted: #6b6b76;
  --primary: #4262ff;
  --primary-hover: #3150ef;
  --primary-soft: #eef1ff;
  --danger: #e5484d;
  --radius: 8px;
  --shadow: 0 2px 10px rgba(16, 18, 30, .08), 0 0 0 1px rgba(16, 18, 30, .04);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------- diapositivas (render) ---------- */
.slide-frame { position: relative; overflow: hidden; background: #fff; flex: none; }
.slide { position: absolute; left: 0; top: 0; width: 1014px; height: 570px; transform-origin: 0 0; overflow: hidden; }
.el { position: absolute; }
.el-content { line-height: 1.43; overflow-wrap: break-word; outline: none; }
.el-content p, .el-content div { margin: 0; }
.el-content ul, .el-content ol { margin: 0; padding-left: 1.4em; }
.el-content li { padding-left: .2em; }
.el-shape { display: flex; align-items: center; }
.el-shape .el-content { width: 100%; padding: 2px 8px; }
.el-image img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; user-select: none; }
.el-brace svg { display: block; overflow: visible; }

/* ---------- botones ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: var(--radius);
  border: 0; background: #f1f1f4; font-weight: 600; font-size: 15px; white-space: nowrap; }
.btn:hover { background: #e7e7ec; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-icon { width: 38px; padding: 0; justify-content: center; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: #f1f1f4; }
.btn svg { flex: none; }

/* ---------- barra superior ---------- */
.topbar { height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 16px 0 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); font-weight: 800; font-size: 22px; letter-spacing: -.02em; padding: 6px 8px; border-radius: var(--radius); }
.brand:hover { background: #f4f4f6; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #1e2c70, #4262ff); color: #fff; display: grid; place-items: center; }
.brand-logo { height: 34px; width: auto; border-radius: 7px; display: block; }
.brand small { font-weight: 600; font-size: 15px; color: var(--muted); letter-spacing: 0; }
.title-input { border: 1px solid transparent; border-radius: 6px; padding: 6px 8px; font-size: 16px; font-weight: 500; min-width: 120px; max-width: 420px; background: transparent; }
.title-input:hover { border-color: var(--line); }
.title-input:focus { border-color: var(--primary); outline: none; }
.save-state { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.save-state.err { color: var(--danger); }
.spacer { flex: 1; }

/* ---------- barra de herramientas ---------- */
.toolbar { height: 60px; display: flex; align-items: center; gap: 4px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tool { width: 40px; height: 40px; border-radius: var(--radius); border: 0; background: transparent; display: grid; place-items: center; flex: none; }
.tool:hover { background: #f1f1f4; }
.tool.active { background: var(--primary-soft); color: var(--primary); }
.tool:disabled { opacity: .35; cursor: default; background: transparent; }
.sep { width: 1px; height: 26px; background: var(--line); margin: 0 8px; flex: none; }
.fmt { display: flex; align-items: center; gap: 4px; flex: none; }
.fmt select, .fmt input[type=number] { height: 34px; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; background: #fff; font-size: 14px; }
.fmt input[type=number] { width: 64px; }
.fmt label { font-size: 12px; color: var(--muted); margin-left: 4px; }
.swatch { width: 34px; height: 34px; border-radius: 6px; border: 1px solid var(--line); position: relative; overflow: hidden; flex: none; display: grid; place-items: center; }
.swatch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.swatch .chip { width: 18px; height: 18px; border-radius: 4px; border: 1px solid rgba(0, 0, 0, .15); }
.swatch .letter { font-weight: 800; font-size: 15px; line-height: 1; border-bottom: 4px solid; padding-bottom: 1px; }

/* ---------- espacio de trabajo ---------- */
.workspace { display: flex; height: calc(100vh - 124px); }
.slides-panel { width: 290px; flex: none; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.panel-head { padding: 20px 20px 12px; }
.new-slide { display: flex; border-radius: var(--radius); background: #f1f1f4; overflow: hidden; }
.new-slide button { border: 0; background: transparent; height: 44px; font-weight: 600; font-size: 17px; }
.new-slide button:hover { background: #e7e7ec; }
.new-slide .main { flex: 1; text-align: left; padding: 0 16px; }
.new-slide .plus { width: 48px; display: grid; place-items: center; border-left: 1px solid #fff; }
.thumbs { flex: 1; overflow-y: auto; padding: 6px 10px 24px; }
.thumb { display: flex; gap: 10px; padding: 8px 10px; border-radius: 10px; position: relative; cursor: pointer; }
.thumb:hover { background: #f6f6f8; }
.thumb.active { background: #eef0fb; }
.thumb .num { width: 20px; font-size: 15px; font-weight: 600; color: #3a3a44; padding-top: 4px; text-align: right; flex: none; }
.thumb.active .num { color: var(--primary); }
.thumb .pic { border: 1px solid var(--line-strong); border-radius: 4px; overflow: hidden; background: #fff; }
.thumb.active .pic { border: 2px solid var(--primary); }
.thumb .more { position: absolute; right: 16px; top: 14px; width: 28px; height: 28px; border-radius: 6px; border: 0; background: rgba(255, 255, 255, .95); box-shadow: var(--shadow); display: none; place-items: center; }
.thumb:hover .more { display: grid; }
.thumb.drop-before::before, .thumb.drop-after::after { content: ''; position: absolute; left: 36px; right: 10px; height: 3px; background: var(--primary); border-radius: 2px; }
.thumb.drop-before::before { top: -2px; }
.thumb.drop-after::after { bottom: -2px; }

.stage-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.stage { flex: 1; min-height: 0; display: grid; place-items: center; position: relative; padding: 20px 36px; }
.stage .slide-frame { box-shadow: 0 0 0 1px var(--line-strong); }
.stage .el { cursor: move; }
.stage .el.editing { cursor: text; }
.stage .el.editing .el-content { cursor: text; user-select: text; }
.stage.tool-create, .stage.tool-create .el { cursor: crosshair; }
.stage .el-content { user-select: none; }
.notes-grip { height: 14px; display: grid; place-items: center; }
.notes-grip span { width: 104px; height: 4px; border-radius: 2px; background: #c9c9d1; }
.notes { padding: 0 32px 24px; }
.notes textarea { width: 100%; height: 72px; resize: vertical; border: 1px solid var(--line); border-radius: 12px; padding: 20px 30px; font-size: 17px; background: #fff; }
.notes textarea:focus { outline: none; border-color: var(--line-strong); }

/* selección */
.sel-box { position: absolute; border: 1.5px solid var(--primary); pointer-events: none; }
.sel-box .h { position: absolute; width: 10px; height: 10px; background: #fff; border: 1.5px solid var(--primary); border-radius: 2px; pointer-events: auto; }
.h.nw { left: -5px; top: -5px; cursor: nwse-resize; } .h.ne { right: -5px; top: -5px; cursor: nesw-resize; }
.h.sw { left: -5px; bottom: -5px; cursor: nesw-resize; } .h.se { right: -5px; bottom: -5px; cursor: nwse-resize; }
.h.n { left: calc(50% - 5px); top: -5px; cursor: ns-resize; } .h.s { left: calc(50% - 5px); bottom: -5px; cursor: ns-resize; }
.h.w { left: -5px; top: calc(50% - 5px); cursor: ew-resize; } .h.e { right: -5px; top: calc(50% - 5px); cursor: ew-resize; }
.guide { position: absolute; background: #ff3d8b; pointer-events: none; }

/* menús */
.menu { position: fixed; z-index: 50; min-width: 190px; background: #fff; border-radius: 10px; box-shadow: 0 8px 28px rgba(16, 18, 30, .16), 0 0 0 1px rgba(16, 18, 30, .06); padding: 6px; }
.menu button { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; background: transparent; padding: 9px 10px; border-radius: 6px; font-size: 14px; text-align: left; }
.menu button:hover { background: #f3f3f6; }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 2px; }

.pop { position: fixed; z-index: 50; width: 380px; background: #fff; border-radius: 12px; box-shadow: 0 8px 28px rgba(16, 18, 30, .16), 0 0 0 1px rgba(16, 18, 30, .06); padding: 18px; }
.pop h3 { margin: 0 0 4px; font-size: 16px; }
.pop p { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; font-size: 14px; font-weight: 600; }
.switch { position: relative; width: 40px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #d4d4dc; border-radius: 12px; transition: .15s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(16px); }
.link-row { display: flex; gap: 8px; }
.link-row input { flex: 1; min-width: 0; height: 38px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 10px; font-size: 13px; background: #f8f8fa; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #1c1c1e; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 100; box-shadow: var(--shadow); }

/* ---------- presentar ---------- */
.present { position: fixed; inset: 0; z-index: 200; background: #0b0b0d; cursor: pointer; }
.present-stage { position: absolute; inset: 0; display: grid; place-items: center; }
.present-hud { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 12px; background: rgba(28, 28, 30, .86); color: #fff; opacity: 0; transition: opacity .25s; }
.present.hud-on .present-hud { opacity: 1; }
.hud-btn { width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; color: #fff; display: grid; place-items: center; }
.hud-btn:hover { background: rgba(255, 255, 255, .14); }
.hud-count { font-size: 14px; min-width: 54px; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- lista de presentaciones ---------- */
.list-wrap { max-width: 1180px; margin: 0 auto; padding: 32px 24px 60px; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.list-head h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.card { background: #fff; border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; cursor: pointer; position: relative; transition: box-shadow .15s, transform .15s; }
.card:hover { box-shadow: 0 6px 20px rgba(16, 18, 30, .12), 0 0 0 1px rgba(16, 18, 30, .05); transform: translateY(-1px); }
.card .pic { background: #fff; border-bottom: 1px solid var(--line); aspect-ratio: 1014 / 570; overflow: hidden; }
.card .meta { padding: 12px 14px; display: flex; align-items: center; gap: 8px; }
.card .meta div { flex: 1; min-width: 0; }
.card .t { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.pill-public { display: inline-flex; align-items: center; gap: 4px; color: #1a7f4b; font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 80px 0; }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login form { width: 100%; max-width: 360px; background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 28px; }
.login h1 { font-size: 20px; margin: 18px 0 4px; }
.login p { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.login input { width: 100%; height: 44px; border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 0 12px; font-size: 15px; margin-bottom: 12px; }
.login input:focus { outline: none; border-color: var(--primary); }
.login .btn { width: 100%; justify-content: center; height: 44px; }
.login .err { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 10px; }

/* ---------- vista pública ---------- */
.viewer-msg { position: fixed; inset: 0; display: grid; place-items: center; color: #9a9aa5; background: #0b0b0d; font-size: 16px; text-align: center; padding: 16px; }

@media (max-width: 760px) {
  .slides-panel { display: none; }
  .brand small, .save-state { display: none; }
  .workspace { height: calc(100vh - 124px); }
  .stage { padding: 12px 16px; }
  .notes { padding: 0 16px 16px; }
  .list-wrap { padding: 20px 16px 40px; }
}
