/* Sistema de diseño de Creadores. Funcional, Inter, oscuro neutro, sin degradados ni pastillas. */
:root {
  --bg: #0c0c0d;
  --panel: #141416;
  --panel-2: #1b1b1e;
  --line: #2a2a2e;
  --line-2: #38383d;
  --text: #ededee;
  --muted: #9a9aa1;
  --faint: #6b6b72;
  --accent: #c8f169;        /* lima: solo estados activos y "hecho" */
  --accent-ink: #0c0c0d;
  --danger: #ff6b5e;
  --warn: #f2c14e;
  --ok: #7ad38a;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 10px 40px rgba(0, 0, 0, .45);
  --font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}
a { color: inherit; }
img, video { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* ---------- Estructura ---------- */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px;
  background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; font-weight: 650; font-size: 16px; letter-spacing: -.01em; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--text); color: var(--bg); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-title { font-size: 12px; color: var(--faint); padding: 0 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--muted); font-size: 14px; cursor: pointer; border: 0; background: none; text-align: left; width: 100%;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active { background: var(--panel-2); color: var(--text); }
.nav-num {
  width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line-2); display: grid; place-items: center;
  font-size: 11px; color: var(--faint); flex: none;
}
.nav-item.done .nav-num { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.nav-item.next .nav-num { border-color: var(--text); color: var(--text); }
.nav-item .nav-hint { margin-left: auto; font-size: 11px; color: var(--faint); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.side-user { padding: 8px 10px; border-top: 1px solid var(--line); padding-top: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 14px 32px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(12, 12, 13, .92); backdrop-filter: blur(6px); z-index: 5; min-height: 59px;
}
.topbar h1 { font-size: 16px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.topbar .spacer { flex: 1; }
.page { padding: 28px 32px 80px; max-width: 1080px; }
.page.wide { max-width: 1400px; }
.topbar .menu-btn { display: none; }

/* Banda de "siguiente paso" */
.nextbar {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: var(--radius); background: var(--panel); margin-bottom: 24px;
}
.nextbar .t { font-size: 14px; }
.nextbar .t b { font-weight: 600; }
.nextbar .spacer { flex: 1; }

/* ---------- Tipografía ---------- */
h2 { font-size: 22px; font-weight: 650; letter-spacing: -.02em; margin: 0 0 6px; }
h3 { font-size: 16px; font-weight: 600; margin: 0 0 4px; letter-spacing: -.01em; }
h4 { font-size: 14px; font-weight: 600; margin: 0 0 4px; }
p { margin: 0 0 10px; }
.lead { color: var(--muted); font-size: 15px; max-width: 680px; margin-bottom: 20px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 13px; }
.center { text-align: center; }

/* ---------- Disposición ---------- */
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 24px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.hr { height: 1px; background: var(--line); margin: 20px 0; border: 0; }

/* ---------- Superficies ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card.flat { background: transparent; }
.card.click { cursor: pointer; transition: border-color .15s; }
.card.click:hover { border-color: var(--line-2); }
.card.selected { border-color: var(--text); }
.section { margin-bottom: 32px; }
.list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item.click { cursor: pointer; }
.list-item.click:hover { background: var(--panel); }
.list-item.selected { background: var(--panel-2); }

/* ---------- Controles ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
  border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  font-weight: 550; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled, .btn.loading { opacity: .55; cursor: default; pointer-events: none; }
.btn-primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-primary:hover { background: #fff; border-color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--panel); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; }
.btn.loading::before {
  content: ''; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
.icon-btn { width: 32px; height: 32px; padding: 0; border-radius: var(--radius-sm); }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 13px; font-weight: 550; color: var(--text); }
.hint { font-size: 12.5px; color: var(--muted); }
.input, .textarea, .select {
  width: 100%; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 9px 12px; outline: none; transition: border-color .12s;
}
.input { height: 40px; }
.textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--text); }
.select { height: 40px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 17px, calc(100% - 13px) 17px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; }
input[type=color] { width: 44px; height: 36px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--bg); padding: 3px; cursor: pointer; }

/* Selector segmentado */
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 7px 14px; font-size: 13.5px; color: var(--muted); cursor: pointer; border-right: 1px solid var(--line-2); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--text); color: var(--bg); }

/* Zona para soltar ficheros */
.drop {
  border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .12s, background .12s;
}
.drop:hover, .drop.over { border-color: var(--text); background: var(--panel); color: var(--text); }

/* Estados */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.status.ok::before { background: var(--ok); }
.status.warn::before { background: var(--warn); }
.status.err::before { background: var(--danger); }
.status.work::before { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.tag { display: inline-block; font-size: 12px; padding: 1px 7px; border: 1px solid var(--line-2); border-radius: 5px; color: var(--muted); }
.notice { padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--panel); font-size: 14px; }
.notice.warn { border-color: rgba(242, 193, 78, .45); }
.notice.err { border-color: rgba(255, 107, 94, .5); }
.notice.ok { border-color: rgba(122, 211, 138, .45); }

.progress { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .4s; }

.empty { text-align: center; padding: 48px 20px; border: 1px dashed var(--line-2); border-radius: var(--radius); color: var(--muted); }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.empty .btn { margin-top: 14px; }

.skeleton { background: linear-gradient(90deg, var(--panel) 0, var(--panel-2) 50%, var(--panel) 100%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--radius-sm); min-height: 16px; }
@keyframes sk { to { background-position: -200% 0; } }

/* Pasos dentro de una pantalla (asistente) */
.wizard-steps { display: flex; gap: 0; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.wizard-steps .ws { padding: 10px 14px; font-size: 13.5px; color: var(--faint); border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; gap: 8px; align-items: center; }
.wizard-steps .ws.on { color: var(--text); border-bottom-color: var(--text); }
.wizard-steps .ws.done { color: var(--muted); }
.wizard-steps .ws.done::before { content: '✓'; color: var(--accent); font-weight: 700; }

/* Pasos para conseguir una clave (Ajustes, bienvenida y donde se pida una clave) */
.aj-pasos { margin: 6px 0 12px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.aj-pasos a { color: var(--text); }

/* Chat de la entrevista */
.chat { display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 80%; padding: 11px 14px; border-radius: 12px; font-size: 14.5px; white-space: pre-wrap; }
.msg.ai { background: var(--panel-2); border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.me { background: var(--text); color: var(--bg); align-self: flex-end; border-bottom-right-radius: 4px; }

/* Editor de correo / vista previa */
.preview-mail { background: #fff; color: #111; border-radius: var(--radius); padding: 28px; font: 16px/1.6 Georgia, 'Times New Roman', serif; }
.preview-mail * { color: #111; }

/* Miniaturas */
.thumb { aspect-ratio: 16/9; background: var(--panel-2); border-radius: var(--radius-sm); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.slides { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
.slides img { width: 240px; aspect-ratio: 4/5; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); scroll-snap-align: start; flex: none; }

/* ---------- Capas ---------- */
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: var(--radius-sm); font-size: 14px; box-shadow: var(--shadow); max-width: 380px; animation: up .2s ease-out; }
.toast.err { background: var(--danger); color: #fff; }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: grid; place-items: center; z-index: 50; padding: 20px; animation: fade .15s; }
.modal { background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; box-shadow: var(--shadow); }
.modal.wide { width: min(900px, 100%); }
.modal-head { padding: 14px 14px 6px 20px; display: flex; align-items: flex-start; gap: 12px; justify-content: space-between; }
.modal-head h3 { padding-top: 4px; }
.modal-x { font-size: 22px; line-height: 1; flex: none; }
.modal-body { padding: 8px 20px 18px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
@keyframes fade { from { opacity: 0; } }

/* Recorrido guiado */
.tour-hole { position: fixed; z-index: 80; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .62); outline: 2px solid var(--accent); transition: all .25s ease; pointer-events: none; }
.tour-pop { position: fixed; z-index: 81; width: 320px; background: var(--text); color: var(--bg); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); transition: top .25s ease, left .25s ease; }
.tour-pop h4 { color: var(--bg); font-size: 15px; }
.tour-pop p { font-size: 14px; color: #333; margin: 0 0 12px; }
.tour-pop .row { justify-content: space-between; }
.tour-pop .btn { height: 32px; font-size: 13px; }
.tour-pop .btn-primary { background: var(--bg); color: var(--text); border-color: var(--bg); }
.tour-pop .btn-ghost { color: #555; }
.tour-pop .count { font-size: 12px; color: #666; }

/* ---------- Acceso ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side { padding: 56px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 28px; }
.auth-side h1 { font-size: 40px; line-height: 1.08; letter-spacing: -.03em; margin: 0; font-weight: 700; max-width: 560px; }
.auth-side .what { display: grid; gap: 0; border-top: 1px solid var(--line); max-width: 560px; }
.auth-side .what div { padding: 14px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 160px 1fr; gap: 12px; font-size: 14px; }
.auth-side .what b { font-weight: 600; }
.auth-form { display: grid; place-items: center; padding: 40px; }
.auth-form form { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; }

/* ---------- Móvil ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .app.menu-open .side { transform: none; box-shadow: var(--shadow); }
  .topbar .menu-btn { display: inline-flex; }
  .topbar, .page { padding-left: 16px; padding-right: 16px; }
  .grid-2, .grid-3, .split { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 28px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .auth-side h1 { font-size: 30px; }
  .auth-side .what { display: none; }
  .msg { max-width: 92%; }
}
@media (max-width: 600px) {
  .nextbar { flex-wrap: wrap; }
  .nextbar .spacer { display: none; }
}
