:root{
  --bg:#0b1320; --panel:#f7f9fc; --ink:#0d2b45; --muted:#5b6b82;
  --brand:#0d2b45; --accent:#136f63; --danger:#b00020; --secondary:#3a506b;
  --radius:16px; --gap:14px; --shadow:0 6px 16px rgba(13,43,69,.12);
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,"Helvetica Neue",Arial;
  background:linear-gradient(180deg,#0b1320 0%,#18273f 100%);
  color:#0d1b2a;
}
.app-header{
  position:sticky; top:0; z-index:10; backdrop-filter:saturate(1.2) blur(6px);
  background:rgba(10,18,32,.7); border-bottom:1px solid rgba(255,255,255,.08);
  padding:14px 18px; display:flex; align-items:center; gap:18px; color:#fff;
}
.app-header h1{margin:0; font-weight:700; letter-spacing:.3px}
.badge{font-size:.8rem; padding:4px 8px; border-radius:999px; background:#136f63}
.tabs{display:flex; gap:8px; flex-wrap:wrap}
.tab-btn{
  color:#fff; background:transparent; border:1px solid rgba(255,255,255,.25);
  padding:8px 12px; border-radius:10px; cursor:pointer
}
.tab-btn.active{background:#136f63; border-color:#136f63}
main{max-width:1200px; margin:24px auto; padding:0 16px}
.tab{display:none}
.tab.active{display:block}
.card{
  background:var(--panel); border-radius:var(--radius); padding:18px; box-shadow:var(--shadow);
}
.form-grid{display:grid; gap:var(--gap)}
.form-grid label{display:grid; gap:6px; font-weight:600; color:var(--ink)}
.form-grid input, .form-grid textarea, .form-grid select{
  border:1px solid #dfe6ef; border-radius:10px; padding:10px 12px; font-size:15px;
  background:#fff;
}
.form-grid textarea{min-height:120px}
.checkbox-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:10px}
.checkbox-grid label{font-weight:500}
.actions{display:flex; gap:10px; align-items:center}
.actions.wrap{flex-wrap:wrap}
.actions .secondary{background:var(--secondary)}
.actions .accent{background:var(--accent)}
.actions .danger{background:var(--danger)}
button{color:#fff; background:var(--brand); border:0; border-radius:10px; padding:10px 14px; cursor:pointer}
button:hover{filter:brightness(1.05)}
button.secondary{background:var(--secondary)}
button.accent{background:var(--accent)}
button.danger{background:var(--danger)}
.list{margin-top:16px; display:grid; gap:12px}
.item{background:#ffffff; border:1px solid #e6ebf2; border-radius:12px; padding:14px}
.item h3{margin:0 0 8px}
.item .chips{display:flex; gap:8px; flex-wrap:wrap; margin-top:8px}
.chip{padding:4px 8px; border-radius:999px; font-size:.85rem; background:#eef3fa; color:#0d2b45}
.item .row{display:flex; gap:8px; flex-wrap:wrap; margin-top:10px}
.poetry-input{width:100%; min-height:280px; resize:vertical; font-size:16px; line-height:1.6; font-family:Georgia,serif}
.result{margin-top:10px; font-weight:700}
.inspiracion{margin-top:8px; font-style:italic; color:#334;}
label.file{position:relative; display:inline-flex; align-items:center; gap:10px; border:1px dashed #c9d5e6; padding:10px 12px; border-radius:10px; cursor:pointer; color:#0d2b45; background:#fff}
label.file input{display:none}
.app-footer{color:#c7d2e0; text-align:center; padding:24px 10px}
.muted{color:#6b7b90; margin-top:8px}
.map-wrap{margin-top:12px; border:1px solid #e6ebf2; border-radius:12px; overflow:auto; background:#fff}
#mapSvg{min-width:1150px; min-height:620px; background:#fff}
.node-rect{fill:#fff; stroke:#94a3b8; stroke-width:1.2; rx:10}
.node-label{font: 13px/1.3 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Arial; fill:#0f172a}
.node-trama{fill:#e0f2fe}
.node-subtrama{fill:#fde68a}
.node-evento{fill:#dcfce7}
.node-personaje{fill:#f1e8ff}
.link{stroke:#64748b; stroke-width:1.4; fill:none; marker-end:url(#arrow)}
.axis-label{font: 12px/1 system-ui; fill:#64748b}
@media (max-width:720px){
  .tabs{overflow:auto}
}
