/* ─── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #f5f5f7;
  --surface:      #ffffff;
  --surface-2:    #f0f0f3;
  --border:       #e2e2e8;
  --border-2:     #c8c8d2;
  --text-1:       #0d0d10;
  --text-2:       #5a5a66;
  --text-3:       #9a9aa6;
  --success:      #17b26a;
  --danger:       #f04438;
  --amber:        #f79009;
  --info:         #2e90fa;
  --purple:       #7B80FF;
  --topbar-h:     52px;
  --setup-h:      82px;
  --sidebar-w:    196px;
  --panel-w:      320px;
  --chrome-h:     calc(var(--topbar-h) + var(--setup-h));
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg);
  color: var(--text-1);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ═══════════════════════════════════════════════════════════════
   TOPBAR — solo logo + acciones
═══════════════════════════════════════════════════════════════ */
#topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  flex-shrink: 0;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.logo-group  { display: flex; align-items: center; gap: 10px; }
.logo-498    { height: 26px; width: auto; filter: brightness(0); }
.logo-sep    { width: 1px; height: 16px; background: var(--border); }
.logo-sam    { font-size: 13px; font-weight: 700; color: var(--text-1); letter-spacing: .03em; }
.logo-v      { font-size: 10px; font-weight: 500; color: var(--text-3); }

.topbar-right { display: flex; align-items: center; gap: 8px; }

/* ═══════════════════════════════════════════════════════════════
   SETUP BAR — debajo del topbar, fila 1 + fila 2
═══════════════════════════════════════════════════════════════ */
#setupBar {
  height: var(--setup-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  flex-shrink: 0;
  z-index: 90;
}

.setup-row {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 38px;
}

/* Separador visual entre filas */
.setup-row-1 { border-bottom: 1px solid var(--border); }

/* Label de sección */
.setup-row-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  width: 60px;
  flex-shrink: 0;
}

.setup-input {
  height: 28px;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid transparent;
  border-radius: 0;
  padding: 0 4px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-1);
  outline: none;
  transition: border-color .15s;
}
.setup-input:focus { border-bottom-color: var(--border-2); }
.setup-input::placeholder { color: var(--text-3); }
.setup-input:not(:placeholder-shown) { font-weight: 500; }

/* Subtle field separators */
.setup-field-sep { width: 1px; height: 14px; background: var(--border); flex-shrink: 0; }

/* Select */
.setup-select {
  height: 28px;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid transparent;
  padding: 0 20px 0 4px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-3);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239a9aa6' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
  transition: border-color .15s, color .15s;
  min-width: 70px;
}
.setup-select:focus { border-bottom-color: var(--border-2); color: var(--text-1); }
.setup-select.has-value { color: var(--text-1); font-weight: 500; }

/* Reg toggles */
.reg-toggles { display: flex; gap: 3px; }
.reg-btn {
  height: 24px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-3);
  cursor: pointer;
  transition: all .12s;
  white-space: nowrap;
}
.reg-btn:hover { color: var(--text-2); border-color: var(--border-2); }
.reg-btn.active {
  background: var(--text-1);
  border-color: var(--text-1);
  color: #fff;
  font-weight: 600;
}

/* Set Goal */
.btn-setgoal {
  height: 24px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all .12s;
  white-space: nowrap;
}
.btn-setgoal:hover { border-color: var(--border-2); color: var(--text-1); }
.btn-setgoal svg { width: 12px; height: 12px; }
.btn-setgoal.goal-set {
  border-color: var(--info);
  color: var(--info);
  background: #2e90fa0e;
}

/* URL wrap */
.url-wrap { display: flex; align-items: center; }
.url-wrap .setup-input { min-width: 180px; }
.btn-import-url {
  height: 20px; width: 20px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  transition: color .12s;
  flex-shrink: 0;
}
.btn-import-url:hover { color: var(--text-1); }
.btn-import-url svg { width: 12px; height: 12px; }

/* Upload */
.btn-upload {
  height: 24px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-2);
  cursor: pointer;
  display: flex; align-items: center; gap: 5px;
  transition: all .12s;
  white-space: nowrap;
}
.btn-upload:hover { border-color: var(--border-2); color: var(--text-1); }
.btn-upload svg { width: 11px; height: 11px; }

/* ═══════════════════════════════════════════════════════════════
   DOWNLOAD / TOPBAR ACTIONS
═══════════════════════════════════════════════════════════════ */
.btn-download {
  height: 32px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-1);
  cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  transition: all .12s;
  white-space: nowrap;
}
.btn-download:hover { background: var(--surface-2); border-color: var(--border-2); }
.btn-download svg { width: 13px; height: 13px; }
.btn-download-dashboard {
  background: var(--text-1);
  border-color: var(--text-1);
  color: #fff;
  font-size: 11px;
  height: 30px;
}
.btn-download-dashboard:hover { opacity: .88; background: var(--text-1); }

/* ═══════════════════════════════════════════════════════════════
   MAIN LAYOUT
═══════════════════════════════════════════════════════════════ */
#main {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* ═══════════════════════════════════════════════════════════════
   EDITOR COLUMN — sin caja, tipo página
═══════════════════════════════════════════════════════════════ */
#editor-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--bg);
}

/* Toolbar sticky — flota sobre fondo gris */
#editor-toolbar-wrap {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 calc((100% - 720px) / 2);
}

/* Quill toolbar */
#editor-toolbar.ql-toolbar.ql-snow {
  border: none !important;
  padding: 6px 0;
  background: transparent;
}
#editor-toolbar .ql-formats { margin-right: 8px; }
#editor-toolbar button, #editor-toolbar .ql-picker {
  color: var(--text-2) !important;
}
#editor-toolbar button:hover, #editor-toolbar button.ql-active {
  color: var(--text-1) !important;
}
#editor-toolbar .ql-stroke { stroke: var(--text-2) !important; }
#editor-toolbar button:hover .ql-stroke,
#editor-toolbar button.ql-active .ql-stroke { stroke: var(--text-1) !important; }
#editor-toolbar .ql-fill { fill: var(--text-2) !important; }
#editor-toolbar .ql-picker-label { color: var(--text-2) !important; font-size: 12px !important; }
#editor-toolbar .ql-picker-item { font-size: 12px !important; }

.word-count-wrap { margin-left: auto !important; display: flex; align-items: center; }
.word-count { font-size: 10px; color: var(--text-3); font-weight: 500; }

/* Editor body — fondo blanco, ancho de documento */
#editor-body-wrap {
  flex: 1;
  padding: 40px calc((100% - 720px) / 2) 80px;
  background: var(--surface);
  min-height: 100%;
}

/* Quill editor */
.ql-container.ql-snow {
  border: none !important;
  font-family: 'Inter', sans-serif !important;
}
.ql-editor {
  min-height: 600px;
  padding: 0 !important;
  font-size: 15px !important;
  line-height: 1.8 !important;
  color: var(--text-1) !important;
}
.ql-editor.ql-blank::before {
  color: var(--text-3) !important;
  font-style: normal !important;
  font-size: 15px !important;
  left: 0 !important;
}
.ql-editor h1 { font-size: 28px !important; font-weight: 700 !important; line-height: 1.3 !important; margin-bottom: 14px !important; color: var(--text-1) !important; }
.ql-editor h2 { font-size: 21px !important; font-weight: 600 !important; line-height: 1.4 !important; margin-bottom: 10px !important; margin-top: 24px !important; }
.ql-editor h3 { font-size: 16px !important; font-weight: 600 !important; margin-bottom: 6px !important; margin-top: 18px !important; }
.ql-editor p { margin-bottom: 10px !important; }
.ql-editor a { color: #2e90fa !important; }

/* Below-editor area (dashboard, loading) */
#below-editor {
  background: var(--bg);
  border-top: 2px solid var(--border);
  padding: 32px calc((100% - 760px) / 2) 60px;
}

/* ═══════════════════════════════════════════════════════════════
   IMPORT LOADING
═══════════════════════════════════════════════════════════════ */
.import-loading {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  font-size: 12px; color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 12px 0;
}
.import-loading svg { width: 15px; height: 15px; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD
═══════════════════════════════════════════════════════════════ */
.dashboard-area { padding-top: 0; }
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.dashboard-title-group { display: flex; align-items: center; gap: 12px; }
.dashboard-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-2);
}
.version-tabs { display: flex; gap: 4px; }
.version-tab {
  height: 26px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  cursor: pointer;
  font-family: inherit;
  transition: all .12s;
}
.version-tab.active {
  background: var(--text-1);
  border-color: var(--text-1);
  color: #fff;
}

/* Score hero */
.score-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  gap: 32px;
  margin-bottom: 12px;
}
.score-big {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; flex-shrink: 0;
}
.score-num { font-size: 52px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.score-label { font-size: 11px; font-weight: 600; margin-top: 4px; }
.score-details { flex: 1; }
.score-details-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.score-stat { display: flex; flex-direction: column; gap: 2px; }
.score-stat-label { font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--text-2); }
.score-stat-val { font-size: 15px; font-weight: 700; color: var(--text-1); }
.score-bar-wrap { margin-top: 16px; }
.score-bar-track { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 4px; transition: width .6s ease; }

/* Eval accordions */
.eval-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.eval-grid .eval-full { grid-column: 1 / -1; }
.eval-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.eval-toggle {
  width: 100%; padding: 11px 14px;
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; background: transparent; border: none;
  text-align: left; font-family: inherit; transition: background .12s;
}
.eval-toggle:hover { background: var(--surface-2); }
.eval-icon {
  width: 24px; height: 24px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; border: 1px solid transparent;
}
.eval-toggle-label { font-size: 11px; font-weight: 600; color: var(--text-1); flex: 1; }
.eval-summary { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.eval-score { font-size: 13px; font-weight: 700; min-width: 34px; text-align: right; }
.eval-bar { width: 50px; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.eval-bar-fill { height: 100%; border-radius: 2px; }
.eval-chevron { width: 14px; height: 14px; color: var(--text-3); flex-shrink: 0; transition: transform .2s; }
.eval-body { border-top: 1px solid var(--border); padding: 12px 14px; }

/* Gaps / improvements */
.gap-list, .impr-list { display: flex; flex-direction: column; gap: 6px; }
.gap-item, .impr-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 7px 10px; border-radius: 7px; font-size: 11px;
}
.gap-item  { background: #f0443808; border: 1px solid #f0443820; }
.impr-item { background: #17b26a08; border: 1px solid #17b26a20; }
.gap-dot   { width: 6px; height: 6px; border-radius: 50%; background: var(--danger);  flex-shrink: 0; margin-top: 4px; }
.impr-dot  { width: 6px; height: 6px; border-radius: 50%; background: var(--success); flex-shrink: 0; margin-top: 4px; }
.delta-badge { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; flex-shrink: 0; }
.delta-pos { background: #17b26a15; color: var(--success); }
.delta-neg { background: #f0443815; color: var(--danger); }

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════════════════ */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 0 14px;
}
.sidebar-tools { display: flex; flex-direction: column; gap: 1px; padding: 0 8px; }

.tool-btn {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px;
  border-radius: 7px; border: none; background: transparent;
  font-size: 12px; font-weight: 500; font-family: inherit;
  color: var(--text-2); cursor: pointer; text-align: left;
  transition: all .12s;
}
.tool-btn:hover { background: var(--surface-2); color: var(--text-1); }
.tool-btn.active { background: var(--surface-2); color: var(--text-1); font-weight: 600; }
.tool-btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.tool-divider { height: 1px; background: var(--border); margin: 5px 8px; }

.tool-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px;
}
.tool-toggle-info {
  display: flex; align-items: center; gap: 9px;
  font-size: 12px; font-weight: 500; color: var(--text-2);
}
.tool-toggle-info svg { width: 15px; height: 15px; }

/* Toggle */
.toggle-switch {
  width: 30px; height: 17px; border-radius: 9px;
  background: var(--border-2); border: none; cursor: pointer;
  position: relative; transition: background .2s; flex-shrink: 0;
}
.toggle-switch.on { background: var(--success); }
.toggle-knob {
  position: absolute; top: 2px; left: 2px;
  width: 13px; height: 13px; border-radius: 50%;
  background: #fff; transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch.on .toggle-knob { transform: translateX(13px); }

/* SAM it! */
.sidebar-bottom { padding: 0 10px; }
.btn-sam {
  width: 100%; height: 38px; border-radius: 9px; border: none;
  background: var(--text-1); color: #fff;
  font-size: 13px; font-weight: 700; font-family: inherit;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  transition: opacity .15s, transform .1s;
}
.btn-sam:hover { opacity: .88; }
.btn-sam:active { transform: scale(.97); }
.btn-sam.loading { opacity: .6; pointer-events: none; }
.btn-sam svg { width: 14px; height: 14px; }
.sam-loading-ring-sm { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin 1s linear infinite; }

/* Tool panel */
.tool-panel {
  width: var(--panel-w); flex-shrink: 0;
  background: var(--surface); border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.tool-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
}
.tool-panel-title { font-size: 13px; font-weight: 600; color: var(--text-1); }
.tool-panel-close {
  width: 24px; height: 24px; border-radius: 6px;
  border: 1px solid var(--border); background: transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.tool-panel-close:hover { background: var(--surface-2); }
.tool-panel-close svg { width: 11px; height: 11px; color: var(--text-2); }
.tool-panel-body { flex: 1; overflow-y: auto; padding: 14px; }

/* AI Chat */
.chat-messages { display: flex; flex-direction: column; gap: 10px; min-height: 200px; margin-bottom: 12px; }
.chat-msg { padding: 9px 12px; border-radius: 8px; font-size: 12px; line-height: 1.55; }
.chat-msg.assistant { background: var(--surface-2); color: var(--text-1); }
.chat-msg.user { background: var(--text-1); color: #fff; align-self: flex-end; max-width: 88%; }
.chat-input-row { display: flex; gap: 6px; }
.chat-input {
  flex: 1; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 12px; font-family: inherit; background: var(--surface-2);
  color: var(--text-1); outline: none; resize: none;
}
.chat-input:focus { border-color: var(--border-2); }
.chat-send {
  width: 32px; height: 32px; border-radius: 8px;
  border: none; background: var(--text-1); color: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.chat-send svg { width: 12px; height: 12px; }

/* Tool items */
.tool-section-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-2); margin-bottom: 8px; }
.tool-item { padding: 8px 10px; background: var(--surface-2); border-radius: 7px; font-size: 11px; color: var(--text-1); line-height: 1.5; margin-bottom: 6px; }
.tool-tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 600; margin-right: 4px; margin-bottom: 4px; }
.attr-tag-present { background: #17b26a15; color: var(--success); border: 1px solid #17b26a30; }
.attr-tag-missing  { background: #f0443810; color: var(--danger);  border: 1px solid #f0443825; }

/* ═══════════════════════════════════════════════════════════════
   MODAL Set Goal
═══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.25);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; width: 480px; max-width: 95vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.12);
  overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 20px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 14px; font-weight: 700; }
.modal-close {
  width: 26px; height: 26px; border-radius: 7px;
  border: 1px solid var(--border); background: transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.modal-close:hover { background: var(--surface-2); }
.modal-close svg { width: 11px; height: 11px; color: var(--text-2); }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.modal-footer {
  padding: 13px 20px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
}

.goal-section { display: flex; flex-direction: column; gap: 8px; }
.goal-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-2); }
.goal-options { display: flex; flex-wrap: wrap; gap: 5px; }
.goal-opt {
  height: 28px; padding: 0 12px;
  border-radius: 7px; border: 1px solid var(--border);
  background: transparent; font-size: 11px; font-weight: 500;
  font-family: inherit; color: var(--text-2); cursor: pointer;
  transition: all .12s;
}
.goal-opt:hover { border-color: var(--border-2); color: var(--text-1); }
.goal-opt.active { background: var(--text-1); border-color: var(--text-1); color: #fff; }
.goal-opt-persona { border-style: dashed; }
.goal-opt-persona.active { border-style: solid; }
.persona-input {
  width: 100%; height: 32px; margin-top: 6px;
  padding: 0 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 12px; font-family: inherit; background: var(--surface-2);
  color: var(--text-1); outline: none;
}
.persona-input:focus { border-color: var(--border-2); }

.btn-modal-cancel {
  height: 32px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--border); background: transparent;
  font-size: 12px; font-weight: 500; font-family: inherit;
  color: var(--text-2); cursor: pointer; transition: all .12s;
}
.btn-modal-cancel:hover { background: var(--surface-2); color: var(--text-1); }
.btn-modal-confirm {
  height: 32px; padding: 0 18px; border-radius: 8px; border: none;
  background: var(--text-1); font-size: 12px; font-weight: 600;
  font-family: inherit; color: #fff; cursor: pointer; transition: opacity .12s;
}
.btn-modal-confirm:hover { opacity: .88; }

/* ─── SAM loading ── */
.sam-loading {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 48px 0; gap: 14px;
}
.sam-loading-ring {
  width: 40px; height: 40px;
  border: 3px solid var(--border); border-top-color: var(--text-1);
  border-radius: 50%; animation: spin 1s linear infinite;
}
.sam-loading-text { font-size: 12px; color: var(--text-2); font-weight: 500; }

/* ─── Utils ── */
.hidden { display: none !important; }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

/* ── SETUP: campos con fondo sutil para indicar que son editables ── */
.setup-input {
  background: rgba(0,0,0,0.03) !important;
  border-radius: 6px !important;
  border: none !important;
  border-bottom: none !important;
  padding: 0 10px !important;
  transition: background .15s !important;
}
.setup-input:focus {
  background: rgba(0,0,0,0.06) !important;
  outline: none !important;
}
.setup-select {
  background-color: rgba(0,0,0,0.03) !important;
  border-radius: 6px !important;
  border: none !important;
  padding-left: 10px !important;
  transition: background .15s !important;
}
.setup-select:focus {
  background-color: rgba(0,0,0,0.06) !important;
  outline: none !important;
}

/* ── Reg buttons menos agresivos cuando inactivos ── */
.reg-btn {
  background: rgba(0,0,0,0.03) !important;
  border-color: transparent !important;
}
.reg-btn:hover {
  background: rgba(0,0,0,0.07) !important;
  border-color: transparent !important;
  color: var(--text-1) !important;
}
.reg-btn.active {
  background: var(--text-1) !important;
  border-color: var(--text-1) !important;
  color: #fff !important;
}

/* ── Toolbar: pegar al texto, sin espacio entre toolbar y editor ── */
#editor-toolbar-wrap {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}
#editor-toolbar.ql-toolbar.ql-snow {
  padding: 5px 0 !important;
}
#editor-body-wrap {
  padding-top: 24px !important;
}

/* ── Ocultar el select "Normal" de Quill, sustituir por H1/H2/H3 directo ── */
.ql-toolbar .ql-picker.ql-header .ql-picker-label::before {
  content: 'Normal';
  font-size: 11px;
}
.ql-toolbar .ql-picker.ql-header {
  width: 72px !important;
}
.ql-toolbar .ql-picker-label {
  font-size: 11px !important;
  padding: 0 4px !important;
}

/* ── Setup bar un poco menos alta, más cómoda ── */
:root {
  --setup-h: 76px !important;
}

/* ── Reg btn active: menos agresivo, tono medio en lugar de negro ── */
.reg-btn.active {
  background: #0d0d10 !important;
  border-color: transparent !important;
  color: #fff !important;
  font-weight: 600 !important;
}
/* Hacerlo un pelín más pequeño para que no pese tanto */
.reg-btn {
  font-size: 11px !important;
  height: 22px !important;
  padding: 0 9px !important;
}
.btn-setgoal {
  height: 22px !important;
  font-size: 11px !important;
  padding: 0 9px !important;
}

/* ── Toolbar: quitar los spinners del select de Safari ── */
.ql-toolbar .ql-picker.ql-header select {
  -webkit-appearance: none !important;
  appearance: none !important;
}
/* H1 H2 H3 labels en el picker */
.ql-toolbar .ql-header .ql-picker-label[data-value="1"]::before { content: 'H1' !important; }
.ql-toolbar .ql-header .ql-picker-label[data-value="2"]::before { content: 'H2' !important; }
.ql-toolbar .ql-header .ql-picker-label[data-value="3"]::before { content: 'H3' !important; }
.ql-toolbar .ql-header .ql-picker-label::before { content: 'Aa' !important; }

/* ── Setup row: un pelo menos alta ── */
.setup-row { height: 36px !important; }

/* ═══════════════════════════════════════════════════════════════
   GLASS EFFECT — botons principals
═══════════════════════════════════════════════════════════════ */

/* SAM it! — dark glass premium */
.btn-sam {
  background: linear-gradient(135deg, #1a1a24 0%, #0d0d10 60%, #1c1c28 100%) !important;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.12) inset,
    0 -1px 0 rgba(0,0,0,0.3) inset,
    0 4px 16px rgba(0,0,0,0.25),
    0 1px 4px rgba(0,0,0,0.15) !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  position: relative;
  overflow: hidden;
}
.btn-sam::before {
  content: '';
  position: absolute;
  inset-x: 0; top: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, transparent 100%);
  pointer-events: none;
}
.btn-sam:hover {
  opacity: 1 !important;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.14) inset,
    0 -1px 0 rgba(0,0,0,0.3) inset,
    0 6px 24px rgba(0,0,0,0.32),
    0 2px 6px rgba(0,0,0,0.18) !important;
}

/* Download — light glass */
.btn-download:not(.btn-download-dashboard) {
  background: rgba(255,255,255,0.75) !important;
  backdrop-filter: blur(12px) saturate(1.4) !important;
  -webkit-backdrop-filter: blur(12px) saturate(1.4) !important;
  border: 1px solid rgba(255,255,255,0.9) !important;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.9) inset,
    0 -1px 0 rgba(0,0,0,0.04) inset,
    0 2px 8px rgba(0,0,0,0.07),
    0 1px 2px rgba(0,0,0,0.05) !important;
}
.btn-download:not(.btn-download-dashboard):hover {
  background: rgba(255,255,255,0.92) !important;
  box-shadow:
    0 1px 0 rgba(255,255,255,1) inset,
    0 -1px 0 rgba(0,0,0,0.04) inset,
    0 4px 14px rgba(0,0,0,0.10),
    0 1px 3px rgba(0,0,0,0.06) !important;
}

/* Download con análisis — dark glass */
.btn-download-dashboard {
  background: linear-gradient(135deg, #1a1a24 0%, #0d0d10 100%) !important;
  border: 1px solid rgba(255,255,255,0.10) !important;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.10) inset,
    0 3px 10px rgba(0,0,0,0.20) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
}

/* Reg btn active — dark glass */
.reg-btn.active {
  background: linear-gradient(135deg, #1a1a24 0%, #0d0d10 100%) !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.10) inset,
    0 2px 6px rgba(0,0,0,0.20) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
}

/* Set Goal — light glass subtil */
.btn-setgoal {
  background: rgba(255,255,255,0.70) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  border: 1px solid rgba(255,255,255,0.85) !important;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.9) inset,
    0 2px 6px rgba(0,0,0,0.06) !important;
}
.btn-setgoal:hover {
  background: rgba(255,255,255,0.90) !important;
}
.btn-setgoal.goal-set {
  background: rgba(46,144,250,0.08) !important;
  border-color: rgba(46,144,250,0.3) !important;
}

/* Upload — light glass */
.btn-upload {
  background: rgba(255,255,255,0.70) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  border: 1px solid rgba(255,255,255,0.85) !important;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.9) inset,
    0 2px 6px rgba(0,0,0,0.06) !important;
}
.btn-upload:hover {
  background: rgba(255,255,255,0.90) !important;
}
