/* ============================================================
   Guionero — estilos
   ============================================================ */
:root {
  --sidebar-w: 232px;
  --bg: #f3f4f6;
  --panel: #ffffff;
  --line: #dfe3e8;
  --line-soft: #eceef1;
  --ink: #1f2937;
  --muted: #6b7280;
  --dark: #141b2d;
  --dark-2: #1e2740;
  --accent: #f59e0b;
  --accent-ink: #7c4a03;
  --blue: #2563eb;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 14px rgba(16,24,40,.05);
  --mono: "Courier New", Courier, monospace;
  --script-size: 12.5px;
  --script-ink: #1f2937;
  --paper-bg: #ffffff;
}

/* ---------- Modo noche ---------- */
body.theme-dark {
  --bg: #0f1420; --panel: #171e2e; --line: #2b3549; --line-soft: #222c3e;
  --ink: #e5e9f2; --muted: #98a3ba; --dark: #0b101b; --dark-2: #151c2b;
  --accent-ink: #fcd34d;
}
body.theme-dark #sidebar { background: #0a0f1a; }
body.theme-dark .card, body.theme-dark .modal { background: #1a2233; border-color: #2b3549; color: #e5e9f2; }
body.theme-dark .btn, body.theme-dark .icon-btn, body.theme-dark #project-select,
body.theme-dark .field input, body.theme-dark .field select, body.theme-dark .field textarea,
body.theme-dark .chip-add input, body.theme-dark .ic-syn, body.theme-dark .suggest-box,
body.theme-dark .type-palette button {
  background: #202a3d; color: #e5e9f2; border-color: #33405a;
}
body.theme-dark .tabs, body.theme-dark #topbar, body.theme-dark .sched-row.head { background: #171e2e; }
body.theme-dark .data-card .desc, body.theme-dark .field label { color: #b8c2d6; }
body.theme-dark .story-img { background: #232d40; }
body.theme-dark kbd { background: #2a3449; border-color: #3a475f; color: #e5e9f2; }
body.theme-dark .preview-note { color: #aab4c8; }
body.theme-dark .empty { background: rgba(255,255,255,.02); }
body.theme-dark .type-palette button:hover { background: #2a3449; border-color: var(--accent); }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }

#app { display: flex; height: 100vh; }

/* ---------- Sidebar ---------- */
#sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--dark);
  color: #d7dce7;
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 16px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #3b2503; font-weight: 800; font-size: 19px;
  display: grid; place-items: center;
  box-shadow: 0 3px 10px rgba(245,158,11,.35);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { color: #fff; font-size: 15px; letter-spacing: .2px; }
.brand-text span { color: #8d98b0; font-size: 11px; }

.btn-new-project {
  border: 1px dashed #4b5878; background: rgba(255,255,255,.04);
  color: #e6eaf3; border-radius: 7px; padding: 9px 10px;
  text-align: left; margin-bottom: 16px; transition: .15s;
}
.btn-new-project:hover { background: rgba(245,158,11,.12); border-color: var(--accent); color: #fff; }
.btn-new-project span { color: var(--accent); font-weight: 700; margin-right: 4px; }

.nav-label {
  font-size: 10px; letter-spacing: 1.4px; color: #68748f;
  padding: 12px 8px 6px; font-weight: 700;
}
#nav, #nav-tools { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; border: 0; background: transparent; color: #b8c1d4;
  padding: 9px 10px; border-radius: 7px; text-align: left;
  transition: .12s; font-size: 13px;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(245,158,11,.16); color: #ffd28a; font-weight: 600; }
.nav-item .ico { width: 18px; text-align: center; font-size: 15px; }
.nav-item .badge {
  margin-left: auto; font-size: 10px; background: rgba(255,255,255,.1);
  padding: 1px 6px; border-radius: 10px; color: #aab4c8;
}
.sidebar-footer { margin-top: auto; padding-top: 18px; }
.link-btn {
  border: 0; background: none; color: #8d98b0; font-size: 12px;
  padding: 6px 8px; text-align: left;
}
.link-btn:hover { color: #fff; }
.storage-line { color: #68748f; font-size: 11px; padding: 4px 8px; }
.storage-line .dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok); margin-right: 6px;
}

/* ---------- Topbar ---------- */
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#topbar {
  height: 56px; flex: 0 0 56px; background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; gap: 12px;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 8px; }
#project-select {
  max-width: 320px; border: 1px solid var(--line); background: #fff;
  border-radius: 7px; padding: 7px 10px; font-weight: 600; color: var(--ink);
}
.icon-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 7px;
  padding: 7px 10px; color: var(--muted); font-size: 12px;
}
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.icon-btn.danger:hover { color: var(--danger); border-color: #f3b5b5; }
.primary-btn {
  background: var(--dark); color: #fff; border: 0; border-radius: 7px;
  padding: 8px 12px; font-size: 12px; font-weight: 600;
}
.primary-btn:hover { background: #263252; }
.save-indicator { color: var(--muted); font-size: 11px; margin-right: 4px; white-space: nowrap; }
.save-indicator.saving { color: var(--accent-ink); }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow); min-width: 230px; padding: 6px; display: none;
}
.dropdown-menu.open { display: block; }
.dropdown-menu button {
  display: block; width: 100%; border: 0; background: none; text-align: left;
  padding: 9px 10px; border-radius: 6px; font-size: 13px; color: var(--ink);
}
.dropdown-menu button:hover { background: var(--bg); }
.dropdown-menu hr { border: 0; border-top: 1px solid var(--line-soft); margin: 5px 2px; }

/* ---------- View ---------- */
#view { flex: 1; min-height: 0; overflow: auto; padding: 22px 26px 60px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-head h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.3px; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 7px; padding: 8px 12px; font-size: 13px;
}
.btn:hover { background: var(--bg); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #412800; font-weight: 600; }
.btn.accent:hover { background: #fbbf24; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--bg); color: var(--ink); }
.btn.small { padding: 5px 9px; font-size: 12px; }
.btn.danger-text { color: var(--danger); }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 18px; }
.empty {
  text-align: center; color: var(--muted); padding: 56px 20px;
  border: 1px dashed var(--line); border-radius: 10px; background: rgba(255,255,255,.5);
}
.empty .big { font-size: 34px; opacity: .5; display: block; margin-bottom: 10px; }
.empty h3 { margin: 0 0 6px; color: var(--ink); }
.empty p { margin: 0 0 16px; }

.grid { display: grid; gap: 14px; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid.cards-wide { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 10px; background: #fff; color: var(--ink); resize: vertical;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245,158,11,.15);
}
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(12,17,30,.55);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: 12px; width: min(560px, 100%);
  max-height: 90vh; overflow: auto; box-shadow: 0 24px 60px rgba(0,0,0,.3);
}
.modal.wide { width: min(860px, 100%); }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.x-btn { border: 0; background: none; font-size: 20px; color: var(--muted); line-height: 1; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button {
  border: 0; background: none; padding: 9px 14px; color: var(--muted);
  border-bottom: 2px solid transparent; font-size: 13px;
}
.tabs button.active { color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }

.badge-pill {
  display: inline-block; background: #eef2ff; color: #3730a3;
  border-radius: 20px; padding: 2px 9px; font-size: 11px; font-weight: 600;
}
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- Editor de guion ---------- */
.editor-layout { display: grid; grid-template-columns: minmax(0,1fr) 236px; gap: 18px; align-items: start; }
.editor-side { position: sticky; top: 0; display: flex; flex-direction: column; gap: 14px; }
.type-palette { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.type-palette button {
  border: 1px solid var(--line); background: #fff; border-radius: 6px;
  padding: 7px 6px; font-size: 11px; text-align: left;
}
.type-palette button:hover { border-color: var(--accent); background: #fffbeb; }
.type-palette kbd { color: var(--muted); font-size: 10px; float: right; }

.script-paper {
  background: var(--paper-bg); border: 1px solid var(--line); border-radius: 6px;
  box-shadow: var(--shadow); padding: 54px 60px 70px;
  font-family: var(--mono); font-size: var(--script-size); line-height: 1.65;
  color: var(--script-ink); min-height: 70vh;
}
.el-row { display: flex; align-items: flex-start; gap: 4px; position: relative; }
.el-row:hover { background: rgba(245,158,11,.05); }
.el-row.focused { background: rgba(245,158,11,.09); }
.el-gutter {
  display: flex; align-items: center; gap: 2px; flex: 0 0 auto;
  width: 116px; padding-top: 3px;
}
.el-gutter select {
  width: 78px; border: 1px solid transparent; background: transparent;
  color: #9aa2b1; font-size: 9px; font-family: var(--mono);
  text-transform: uppercase; padding: 2px; border-radius: 4px;
}
.el-gutter select:hover, .el-gutter select:focus { border-color: var(--line); color: var(--ink); background: #fff; }
.el-tools { display: flex; gap: 0; opacity: 0; transition: opacity .12s; }
.el-row:hover .el-tools, .el-row.focused .el-tools { opacity: 1; }
.el-tools button {
  border: 0; background: none; color: #9aa2b1; font-size: 10px; padding: 2px 3px;
}
.el-tools button:hover { color: var(--ink); }
.el-text {
  border: 0; outline: 0; resize: none; overflow: hidden;
  font-family: var(--mono); font-size: var(--script-size); line-height: 1.65;
  flex: 1; min-width: 0; padding: 0; background: transparent; color: var(--script-ink);
  white-space: pre-wrap;
}
.el-row[data-type="scene"] .el-text { text-transform: uppercase; font-weight: 700; }
.el-row[data-type="character"] .el-text { margin-left: 20%; font-weight: 700; text-transform: uppercase; }
.el-row[data-type="dialogue"] .el-text { margin-left: 10%; margin-right: 18%; }
.el-row[data-type="parenthetical"] .el-text { margin-left: 16%; margin-right: 24%; font-style: italic; }
.el-row[data-type="transition"] .el-text { margin-left: 45%; text-transform: uppercase; }
.el-row[data-type="note"] .el-text { margin-left: 6%; color: #7c8394; font-style: italic; }
.el-row[data-type="action"] .el-text { margin-right: 5%; }
.el-row[data-type="section"] .el-text { color: #3730a3; font-weight: 700; }
.el-row[data-type="act"] .el-text { text-align: center; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-top: 18px; }
.el-row[data-type="shot"] .el-text { margin-left: 5%; font-weight: 700; text-transform: uppercase; color: #475569; }
.el-row[data-type="text"] .el-text { font-style: italic; margin-right: 5%; }
.el-row[data-type="intercut"] .el-text { text-transform: uppercase; font-weight: 700; font-style: italic; }
.el-row[data-type="dual"] .el-text { margin-left: 5%; margin-right: 5%; }
.el-row[data-type="pagebreak"] { border-top: 1px dashed var(--line); margin: 10px 0; }
.el-row[data-type="pagebreak"] .el-text { color: var(--muted); font-size: 10px; font-style: italic; }

.preview-paper {
  background: var(--paper-bg); border: 1px solid var(--line); box-shadow: var(--shadow);
  padding: 60px 70px; font-family: var(--mono); font-size: var(--script-size); line-height: 1.7;
  color: var(--script-ink); min-height: 70vh; white-space: pre-wrap;
}
.preview-title { text-align: center; font-weight: 700; margin-bottom: 30px; text-transform: uppercase; }
.preview-scene { text-transform: uppercase; font-weight: 700; margin-top: 18px; }
.preview-character { margin-left: 20%; font-weight: 700; text-transform: uppercase; }
.preview-dialogue { margin-left: 10%; margin-right: 18%; }
.preview-parenthetical { margin-left: 16%; margin-right: 24%; font-style: italic; }
.preview-transition { margin-left: 45%; text-transform: uppercase; }
.preview-note { margin-left: 6%; color: #7c8394; font-style: italic; }
.preview-action { margin-right: 5%; }
.preview-section { color: #3730a3; font-weight: 700; }
.preview-act { text-align: center; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; margin: 30px 0 16px; }
.preview-shot { margin-left: 5%; font-weight: bold; text-transform: uppercase; color: #475569; }
.preview-text { font-style: italic; margin-right: 5%; }
.preview-intercut { text-transform: uppercase; font-weight: bold; font-style: italic; margin-top: 18px; }
.dual-columns { display: flex; gap: 24px; margin: 4px 5%; }
.dual-col { flex: 1; min-width: 0; }
.dual-col .dc-char { font-weight: bold; text-transform: uppercase; margin-bottom: 3px; }
.preview-paper .omitted, .el-row.omitted .el-text { text-decoration: line-through; opacity: .6; }
.av-row { display: grid; grid-template-columns: 30% 1fr; gap: 18px; }
.av-shot { font-weight: bold; text-transform: uppercase; color: #475569; }
.preview-pagebreak { border-top: 1px dashed #cbd5e1; margin: 22px 0; }

.stats-line { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 11px; padding: 8px 2px; }

/* ---------- Storyboard ---------- */
.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.story-card { overflow: hidden; display: flex; flex-direction: column; }
.story-img {
  height: 140px; background: #eef1f5; display: grid; place-items: center;
  color: #98a1b0; font-size: 12px; text-align: center; cursor: pointer;
  background-size: cover; background-position: center; position: relative;
}
.story-img .change { position: absolute; bottom: 6px; right: 6px; background: rgba(0,0,0,.6); color: #fff; padding: 3px 7px; border-radius: 4px; font-size: 10px; }
.story-body { padding: 12px; }
.story-body h3 { font-size: 12px; margin: 0 0 6px; font-family: var(--mono); text-transform: uppercase; }
.story-body p { font-size: 12px; color: var(--muted); margin: 0 0 8px; white-space: pre-wrap; }
.story-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.shot-tag { background: #f1f5f9; color: #475569; border-radius: 4px; padding: 2px 7px; font-size: 10px; }

/* ---------- Desglose ---------- */
.breakdown-layout { display: grid; grid-template-columns: 230px minmax(0,1fr); gap: 16px; align-items: start; }
.scene-list { display: flex; flex-direction: column; gap: 4px; max-height: 72vh; overflow: auto; }
.scene-list button {
  border: 0; background: none; text-align: left; padding: 9px 10px;
  border-radius: 6px; font-size: 12px; font-family: var(--mono); color: var(--muted);
}
.scene-list button:hover { background: var(--bg); }
.scene-list button.active { background: #fffbeb; color: var(--accent-ink); font-weight: 700; border: 1px solid #fde68a; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.cat-card h4 { margin: 0 0 9px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; }
.chip {
  background: #eef2ff; color: #3730a3; border-radius: 20px; padding: 3px 6px 3px 10px;
  font-size: 11px; display: inline-flex; align-items: center; gap: 5px;
}
.chip button { border: 0; background: none; color: inherit; opacity: .5; padding: 0 2px; }
.chip button:hover { opacity: 1; }
.chip-add { display: flex; gap: 5px; margin-top: 9px; }
.chip-add input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 5px; padding: 5px 8px; font-size: 12px; }
.chip-add button { border: 1px solid var(--line); background: #fff; border-radius: 5px; padding: 5px 9px; font-size: 12px; }

/* ---------- Tarjetas de datos ---------- */
.data-card { padding: 15px; }
.data-card h3 { margin: 0 0 4px; font-size: 15px; }
.data-card .meta { color: var(--muted); font-size: 11px; margin-bottom: 8px; }
.data-card .desc { font-size: 12px; color: #4b5563; white-space: pre-wrap; margin-bottom: 12px; }
.data-card .foot { display: flex; gap: 6px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.color-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: middle; }

/* ---------- Calendario ---------- */
.sched-row { display: grid; grid-template-columns: 100px 84px minmax(0,1.3fr) minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.sched-row:last-child { border-bottom: 0; }
.sched-row.head { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; background: #fafbfc; }
.sched-date { font-weight: 700; font-size: 13px; }
.sched-status { font-size: 10px; border-radius: 20px; padding: 2px 8px; font-weight: 600; }
.st-plan { background: #fef3c7; color: #92400e; }
.st-rodado { background: #dcfce7; color: #166534; }
.st-cancelado { background: #fee2e2; color: #991b1b; }

/* ---------- Ajuda modal ---------- */
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; }
.help-grid div { padding: 6px 0; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
kbd {
  background: #f3f4f6; border: 1px solid #d1d5db; border-bottom-width: 2px;
  border-radius: 4px; padding: 1px 5px; font-family: var(--mono); font-size: 11px;
}

/* ---------- Botones desactivados ---------- */
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn:disabled:hover { background: #fff; color: var(--muted); }

/* ---------- Portada y numeración en vista previa ---------- */
.preview-paper .cover-page { text-align: center; padding-top: 12%; page-break-after: always; }
.cover-logo { max-width: 55%; max-height: 6cm; display: block; margin: 0 auto 30px; }
.cover-title { font-size: 20pt; font-weight: bold; text-transform: uppercase; margin-bottom: 18px; }
.cover-subtitle { font-size: 13pt; font-style: italic; margin-bottom: 26px; }
.cover-author { font-size: 14pt; margin-bottom: 30px; }
.cover-company { font-size: 13pt; font-weight: bold; margin: 40px 0 10px; }
.cover-small { font-size: 10pt; margin: 5px 0; }
.scene-line { display: flex; align-items: baseline; gap: 8px; }
.scene-line .preview-scene { flex: 1; }
.scene-num { font-size: 9pt; color: #888; flex: 0 0 auto; }
.scene-num.right { order: 3; }

/* ---------- Tarjetas de índice ---------- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.index-card {
  padding: 12px; min-height: 180px; display: flex; flex-direction: column;
  border: 1px solid rgba(0,0,0,.12); transition: transform .12s, box-shadow .12s;
}
.index-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.12); }
.index-card.dragging { opacity: .45; }
.ic-top { display: flex; align-items: center; gap: 8px; }
.ic-num { font-weight: 800; font-size: 12px; background: rgba(0,0,0,.08); border-radius: 4px; padding: 2px 7px; }
.ic-drag { cursor: grab; color: #64748b; font-size: 14px; margin-left: auto; }
.ic-heading { font-family: var(--mono); font-size: 12px; text-transform: uppercase; margin: 10px 0 8px; }
.ic-syn {
  flex: 1; width: 100%; border: 1px solid rgba(0,0,0,.1); border-radius: 5px;
  padding: 7px; font-size: 12px; resize: vertical; background: rgba(255,255,255,.65);
}
.ic-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 9px; gap: 8px; }
.ic-colors { display: flex; gap: 3px; }
.ic-colors button { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); padding: 0; }
.ic-colors button.sel { outline: 2px solid #1f2937; }

/* ---------- Sugerencias (element assist) ---------- */
.suggest-box {
  position: fixed; z-index: 150; background: #fff;
  border: 1px solid var(--line); border-radius: 7px; box-shadow: var(--shadow);
  padding: 4px; font-family: var(--mono); font-size: 12px;
  max-height: 220px; overflow: auto;
}
.suggest-box div { padding: 6px 9px; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.suggest-box div:hover, .suggest-box div.active { background: #fffbeb; color: var(--accent-ink); }

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--dark); color: #fff; padding: 10px 16px; border-radius: 8px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: .25s; z-index: 200;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Modo enfoque ---------- */
#focus-exit, #focus-mic {
  display: none; position: fixed; z-index: 210; top: 16px;
  border: 1px solid var(--line); background: rgba(255,255,255,.92); color: var(--ink);
  border-radius: 8px; padding: 8px 12px; font-size: 12px; box-shadow: var(--shadow);
}
#focus-exit { right: 16px; }
#focus-mic { right: 130px; }
body.focus-mode { overflow: hidden; }
body.focus-mode #sidebar, body.focus-mode #topbar, body.focus-mode .editor-side,
body.focus-mode .page-head, body.focus-mode .tabs, body.focus-mode .stats-line { display: none !important; }
body.focus-mode #view { padding: 0; overflow: auto; }
body.focus-mode .script-paper {
  border: 0; box-shadow: none; min-height: 100vh;
  padding: 10vh 12vw; font-size: calc(var(--script-size) * 1.3);
}
body.focus-mode .el-row.focused { background: rgba(245,158,11,.14); }
body.focus-mode #focus-exit, body.focus-mode #focus-mic { display: block; }
body.theme-dark #focus-exit, body.theme-dark #focus-mic { background: #202a3d; color: #e5e9f2; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .editor-layout, .breakdown-layout { grid-template-columns: 1fr; }
  .editor-side { position: static; }
  .script-paper { padding: 30px 24px; }
}
@media (max-width: 720px) {
  :root { --sidebar-w: 62px; }
  .brand-text, .nav-label, .btn-new-project span + span, .nav-item span:not(.ico),
  .nav-item .badge, .storage-line, .link-btn { display: none; }
  .btn-new-project { text-align: center; font-size: 18px; }
  .nav-item { justify-content: center; }
  #view { padding: 16px 12px 50px; }
  .sched-row { grid-template-columns: 1fr; gap: 4px; }
  .sched-row.head { display: none; }
  .topbar-right .save-indicator, #btn-import { display: none; }
}

/* ---------- Impresión ---------- */
@media print {
  body { overflow: visible; background: #fff; }
  #sidebar, #topbar, .editor-side, .page-head .head-actions, .tabs, #toast { display: none !important; }
  #main, #view { overflow: visible; padding: 0; }
  .script-paper, .preview-paper {
    border: 0; box-shadow: none; padding: 0; font-size: 12pt; min-height: 0;
  }
  .el-gutter, .el-tools { display: none !important; }
  .el-row { display: block; page-break-inside: avoid; }
  .el-text { width: 100%; overflow: visible; }
  .el-row[data-type="scene"], .preview-scene { page-break-before: auto; }
  @page { margin: 2.5cm 3cm; }
}
