/* ==========================================================================
   Radar Empleo — sistema de diseño
   Marca: escala burdeos · Neutros: grises cálidos · Tipografía: Inter
   ========================================================================== */
:root {
  --brand-50: #fbf4f5;
  --brand-100: #f6e4e7;
  --brand-200: #ecc6cc;
  --brand-300: #dc9ca6;
  --brand-400: #c46b7a;
  --brand-500: #a8434f;
  --brand-600: #8e2e3c;
  --brand-700: #74202f;
  --brand-800: #5b1825;
  --brand-900: #43111b;
  --brand-950: #2a0910;

  --gray-0: #ffffff;
  --gray-25: #fcfbfb;
  --gray-50: #f7f6f6;
  --gray-100: #f0eeee;
  --gray-200: #e3dfdf;
  --gray-300: #d0caca;
  --gray-400: #a8a0a1;
  --gray-500: #7c7374;
  --gray-600: #5d5556;
  --gray-700: #453e3f;
  --gray-800: #2d2829;
  --gray-900: #1c1819;

  --success-50: #ecf7f1;
  --success-600: #1f7a4d;
  --success-700: #17603c;
  --warning-50: #fdf5e7;
  --warning-600: #a15c07;
  --warning-700: #82490a;
  --danger-50: #fef1f0;
  --danger-600: #c0271b;
  --danger-700: #9b1d14;
  --info-50: #eef3fa;
  --info-600: #3a5f99;

  --bg: var(--gray-50);
  --surface: var(--gray-0);
  --border: var(--gray-200);
  --border-strong: var(--gray-300);
  --text: var(--gray-900);
  --text-2: var(--gray-600);
  --text-3: var(--gray-500);

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-xs: 0 1px 2px rgba(28, 24, 25, .05);
  --shadow-sm: 0 1px 3px rgba(28, 24, 25, .07), 0 1px 2px rgba(28, 24, 25, .04);
  --shadow-lg: 0 16px 32px -12px rgba(28, 24, 25, .18);
  --ring: 0 0 0 3px rgba(168, 67, 79, .18);

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar-w: 248px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.5 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-700); text-decoration: none; }
a:hover { color: var(--brand-800); text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; color: var(--gray-900); letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 650; line-height: 1.3; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0 0 .75rem; }
ul { margin: 0; padding-left: 1.1rem; }
.muted { color: var(--text-3); }
.small { font-size: 13px; }
.xsmall { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
.icon-lg { width: 20px; height: 20px; }

/* --------------------------------------------------------------- App shell */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--brand-950);
  background-image: linear-gradient(180deg, #330b14 0%, var(--brand-950) 60%);
  color: #e8d6d9;
  display: flex; flex-direction: column;
  border-right: 1px solid #3a0f18;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; font-weight: 650; font-size: 15px; letter-spacing: -.01em; }
.sidebar-brand:hover { color: #fff; text-decoration: none; }
.logo { width: 30px; height: 30px; flex: none; }
.nav-section { padding: 10px 10px 2px; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: #a8838a; padding: 8px 10px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; margin: 1px 0; border-radius: var(--radius-sm);
  color: #e3cfd3; font-weight: 500; font-size: 13.5px;
}
.nav-link .icon { color: #b8949b; }
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav-link.active { background: rgba(255, 255, 255, .1); color: #fff; box-shadow: inset 2px 0 0 var(--brand-300); }
.nav-link.active .icon { color: var(--brand-200); }
.nav-count { margin-left: auto; font-size: 11.5px; font-weight: 600; background: var(--brand-600); color: #fff; border-radius: 999px; padding: 0 7px; line-height: 18px; }
.sidebar-foot { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255, 255, 255, .07); }
.system-line { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #b8949b; padding: 4px 8px 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-600); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.user-meta { min-width: 0; line-height: 1.3; }
.user-name { color: #fff; font-weight: 600; font-size: 13px; }
.user-mail { color: #b8949b; font-size: 12px; }
.icon-btn-dark { margin-left: auto; color: #b8949b; background: none; border: 0; padding: 6px; border-radius: var(--radius-sm); cursor: pointer; display: grid; place-items: center; }
.icon-btn-dark:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.scrim { display: none; }
.mobilebar { display: none; }
.content { width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px 32px 64px; }

/* --------------------------------------------------------------- Page header */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-header .subtitle { color: var(--text-2); margin-top: 4px; font-size: 13.5px; }
.breadcrumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); margin-bottom: 6px; }
.breadcrumbs a { color: var(--text-3); }
.breadcrumbs .icon { width: 13px; height: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* --------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--gray-800);
  font: 550 13.5px/1 var(--font); cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-xs); transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--gray-50); color: var(--gray-900); text-decoration: none; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn .icon { color: currentColor; }
.btn-primary { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.btn-primary:hover { background: var(--brand-800); border-color: var(--brand-800); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-danger { color: var(--danger-600); }
.btn-danger:hover { background: var(--danger-50); color: var(--danger-700); border-color: #f2c2bd; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-icon { width: 30px; height: 30px; padding: 0; }
.btn-group { display: inline-flex; }
.btn-group form + form .btn, .btn-group > .btn + .btn { margin-left: -1px; }
.inline-form { display: inline; margin: 0; }

/* --------------------------------------------------------------- Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-header h2 { font-size: 14.5px; }
.card-header .muted { font-size: 12.5px; }
.card-body { padding: 18px; }
.card-body.tight { padding: 6px 0; }
.card-footer { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--gray-25); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.layout-aside { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 8px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.sticky { position: sticky; top: 20px; }

/* --------------------------------------------------------------- Stats */
.stat { padding: 16px 18px; }
.stat-label { display: flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.stat-label .icon { color: var(--brand-500); }
.stat-value { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-foot { color: var(--text-3); font-size: 12px; margin-top: 2px; }

/* --------------------------------------------------------------- Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 550; white-space: nowrap;
  background: var(--gray-100); color: var(--gray-700); border: 1px solid transparent;
}
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge-brand { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.badge-success { background: var(--success-50); color: var(--success-700); }
.badge-warning { background: var(--warning-50); color: var(--warning-700); }
.badge-danger { background: var(--danger-50); color: var(--danger-700); }
.badge-info { background: var(--info-50); color: var(--info-600); }
.badge-outline { background: transparent; border-color: var(--border-strong); color: var(--text-2); }

/* Compatibilidad: frase + barras en vez del número */
.fit {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  width: 76px; min-height: 56px; padding: 8px 4px; border-radius: 10px; flex: none; align-self: start;
  font-size: 11.5px; font-weight: 600; line-height: 1.2; text-align: center;
}
.fit-bars { display: flex; gap: 3px; }
.fit-bars i { width: 11px; height: 5px; border-radius: 2px; background: currentColor; opacity: .25; }
.fit-bars i.on { opacity: 1; }
.fit-top { background: var(--brand-700); color: #fff; }
.fit-high { background: var(--brand-500); color: #fff; }
.fit-mid { background: var(--brand-100); color: var(--brand-800); }
.fit-low { background: var(--gray-100); color: var(--gray-600); }

/* --------------------------------------------------------------- Alerts / toasts */
.messages { list-style: none; padding: 0; margin: 0 0 18px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius); border: 1px solid; font-size: 13.5px; margin-bottom: 8px; background: var(--surface); }
.alert .icon { margin-top: 2px; }
.alert-success, .alert.success { border-color: #bfe3cf; background: var(--success-50); color: var(--success-700); }
.alert-info, .alert.info { border-color: #cfdcf0; background: var(--info-50); color: var(--info-600); }
.alert-warning, .alert.warning { border-color: #f1d6a8; background: var(--warning-50); color: var(--warning-700); }
.alert-error, .alert.error { border-color: #f5c6c1; background: var(--danger-50); color: var(--danger-700); }
.alert-brand { border-color: var(--brand-200); background: var(--brand-50); color: var(--brand-800); }

/* --------------------------------------------------------------- Progress / meters */
.progress { height: 8px; background: var(--gray-100); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand-600); border-radius: 999px; transition: width .6s ease; }

/* --------------------------------------------------------------- Indicadores de carga */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.spinner {
  display: inline-block; width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
/* Barra fina arriba de la página mientras carga la siguiente */
.page-progress {
  position: fixed; top: 0; left: 0; z-index: 100; height: 3px; width: 0; opacity: 0; pointer-events: none;
  background: var(--brand-500); box-shadow: 0 0 8px rgba(142, 46, 60, .45);
  transition: width .4s ease, opacity .25s ease;
}
.page-progress.is-active { opacity: 1; }
/* Botón presionado: muestra que está trabajando y evita el doble envío */
.btn.is-loading { pointer-events: none; opacity: .8; }
.btn.is-loading .icon { display: none; }
.btn.is-loading::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
.btn-icon.is-loading::before { margin: 0; }

/* Avance real de una búsqueda */
.run-progress { margin-bottom: 20px; border-color: var(--brand-100); }
.rp-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.rp-head .spinner { width: 20px; height: 20px; color: var(--brand-600); }
.run-progress.is-done .rp-head .spinner { animation: none; border-color: var(--success-600); }
.rp-label { font-weight: 600; color: var(--gray-900); }
.rp-sub { font-size: 12.5px; color: var(--text-3); }
.rp-pct { margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--brand-700); }
.rp-steps { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; margin: 14px 0 0; padding: 0; font-size: 12.5px; color: var(--text-3); }
.rp-steps li { display: inline-flex; align-items: center; gap: 7px; }
.rp-steps li::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--gray-200); }
.rp-steps li.done { color: var(--text-2); }
.rp-steps li.done::before { background: var(--success-600); }
.rp-steps li.current { color: var(--brand-700); font-weight: 600; }
.rp-steps li.current::before { background: var(--brand-600); box-shadow: 0 0 0 3px var(--brand-100); }
.rp-note { margin: 10px 0 0; font-size: 12px; color: var(--text-3); }

/* Ventana para tareas largas con IA (analizar CV, completar búsqueda) */
.task-overlay {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px;
  background: rgba(28, 24, 25, .55); animation: fade-in .15s ease;
}
.task-card { width: min(440px, 100%); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 24px 24px 20px; }
.task-card .progress > span { transition: none; }
.task-card .task-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-700); }
.task-card .task-icon .spinner { width: 20px; height: 20px; }
.task-card h2 { font-size: 18px; font-weight: 650; margin: 14px 0 4px; }
.task-card .task-lead { color: var(--text-2); font-size: 13.5px; margin: 0 0 16px; }
.task-steps { list-style: none; padding: 0; margin: 16px 0 14px; display: grid; gap: 10px; font-size: 13.5px; }
.task-steps li { display: flex; align-items: center; gap: 10px; color: var(--text-3); }
.task-steps .mark { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 2px solid var(--gray-200); display: grid; place-items: center; }
.task-steps li.current { color: var(--gray-900); font-weight: 550; }
.task-steps li.current .mark { border-color: var(--brand-600); border-right-color: transparent; animation: spin .8s linear infinite; }
.task-steps li.done { color: var(--text-2); }
.task-steps li.done .mark { background: var(--brand-600); border-color: var(--brand-600); }
.task-steps li.done .mark::after { content: ""; width: 4px; height: 8px; margin-top: -2px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.task-foot { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--text-3); }
@media (prefers-reduced-motion: reduce) {
  .spinner, .btn.is-loading::before, .task-steps li.current .mark { animation-duration: 2s; }
  .page-progress, .progress > span { transition: none; }
}
.meter-list { display: grid; gap: 7px; }
.meter { display: grid; grid-template-columns: 92px minmax(0, 1fr) 42px; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-2); }
.meter .bar { height: 6px; background: var(--gray-100); border-radius: 999px; overflow: hidden; }
.meter .bar span { display: block; height: 100%; background: var(--brand-500); border-radius: 999px; }
.meter .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--gray-700); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot-ok { background: #2f9e64; box-shadow: 0 0 0 3px rgba(47, 158, 100, .15); }
.dot-warn { background: #d08a19; box-shadow: 0 0 0 3px rgba(208, 138, 25, .15); }
.dot-err { background: #d33a2c; box-shadow: 0 0 0 3px rgba(211, 58, 44, .15); }
.dot-off { background: var(--gray-400); }

/* --------------------------------------------------------------- Tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); background: var(--gray-25); padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--gray-25); }
.table .cell-title { font-weight: 600; color: var(--gray-900); }
.table .cell-sub { color: var(--text-3); font-size: 12.5px; }
.table .right { text-align: right; }

/* --------------------------------------------------------------- Tabs / toolbar */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px; font-weight: 550; font-size: 13.5px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--gray-900); text-decoration: none; }
.tab.active { color: var(--brand-700); border-bottom-color: var(--brand-700); }
.tab .count { font-size: 11.5px; font-weight: 600; background: var(--gray-100); color: var(--text-2); border-radius: 999px; padding: 0 7px; line-height: 18px; }
.tab.active .count { background: var(--brand-50); color: var(--brand-700); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .search { position: relative; flex: 1 1 260px; max-width: 380px; }
.toolbar .search .icon { position: absolute; left: 10px; top: 10px; color: var(--text-3); }
.toolbar .search input { padding-left: 32px; }
.toolbar select { width: auto; min-width: 170px; }

/* --------------------------------------------------------------- Offers list */
.offer-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.offer { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 16px; padding: 16px 18px; border-bottom: 1px solid var(--gray-100); }
.offer:last-child { border-bottom: 0; }
.offer:hover { background: var(--gray-25); }
.offer-title { font-size: 14.5px; font-weight: 600; color: var(--gray-900); }
.offer-title:hover { color: var(--brand-700); }
.offer-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--text-2); font-size: 12.5px; margin-top: 4px; }
.offer-meta span { display: inline-flex; align-items: center; gap: 5px; }
.offer-meta .icon { width: 14px; height: 14px; color: var(--text-3); }
.offer-summary { color: var(--gray-700); font-size: 13px; margin-top: 8px; max-width: 820px; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.offer-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.offer-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.offer-actions { display: flex; gap: 4px; }
.offer details { margin-top: 10px; }
.offer summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 4px; color: var(--brand-700); font-weight: 550; font-size: 12.5px; }
.offer summary::-webkit-details-marker { display: none; }
.offer details[open] summary .icon { transform: rotate(180deg); }
.analysis { margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--gray-25); padding: 14px 16px; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; }
.analysis h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 600; margin-bottom: 6px; }
.analysis ul { font-size: 13px; color: var(--gray-700); }
.analysis li { margin-bottom: 2px; }
.analysis .desc { white-space: pre-line; font-size: 12.5px; color: var(--text-2); max-height: 260px; overflow: auto; }
.warn-text { color: var(--warning-700); font-size: 12.5px; display: flex; gap: 6px; align-items: flex-start; margin-top: 6px; }
.excl-text { color: var(--danger-700); font-size: 12.5px; display: flex; gap: 6px; align-items: flex-start; margin-top: 6px; }

/* --------------------------------------------------------------- Forms */
label, .label { display: block; font-weight: 550; font-size: 13px; color: var(--gray-800); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search], select, textarea {
  width: 100%; min-height: 36px; padding: 7px 11px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: 400 14px/1.4 var(--font);
  box-shadow: var(--shadow-xs); transition: border-color .12s, box-shadow .12s;
}
textarea { resize: vertical; min-height: 72px; }
select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237c7374' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-400); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--gray-400); }
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.helptext { display: block; color: var(--text-3); font-size: 12.5px; margin-top: 5px; }
.errorlist { list-style: none; padding: 0; margin: 5px 0 0; color: var(--danger-600); font-size: 12.5px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }

/* Interruptor (checkbox) */
.switch { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; cursor: pointer; margin: 0; }
.switch input { appearance: none; width: 34px; height: 20px; border-radius: 999px; background: var(--gray-300); position: relative; flex: none; margin: 1px 0 0; cursor: pointer; transition: background .15s; box-shadow: none; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s; }
.switch input:checked { background: var(--brand-600); }
.switch input:checked::after { transform: translateX(14px); }
.switch input:focus-visible { box-shadow: var(--ring); }
.switch-text { display: block; }
.switch-text small { display: block; color: var(--text-3); font-weight: 400; font-size: 12.5px; }

/* Selección de fuentes (checkbox cards) */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.choice-grid > div, .choice-grid ul { display: contents; }
.choice-grid li, .choice-grid label { list-style: none; }
.choice-grid label { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-weight: 500; font-size: 13px; cursor: pointer; margin: 0; background: var(--surface); }
.choice-grid label:hover { border-color: var(--brand-300); }
.choice-grid input { accent-color: var(--brand-700); width: 15px; height: 15px; }

/* Listas editables: caja + botón Agregar, y lo agregado debajo como etiquetas */
.tag-field { display: grid; gap: 8px; }
.tag-entry { display: flex; gap: 8px; }
.tag-entry input { flex: 1 1 auto; min-width: 0; }
.tag-entry .btn { flex: none; }
.tag-entry .btn:disabled { opacity: .55; cursor: default; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-empty { font-size: 12.5px; color: var(--text-3); }
.tag { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 2px 4px 2px 10px; background: var(--brand-50); color: var(--brand-800); border: 1px solid var(--brand-100); border-radius: 6px; font-size: 13px; font-weight: 500; }
.tag button { border: 0; background: none; color: var(--brand-500); cursor: pointer; width: 20px; height: 20px; border-radius: 4px; display: grid; place-items: center; font-size: 16px; line-height: 1; padding: 0; }
.tag button:hover { background: var(--brand-100); color: var(--brand-800); }
.tag.is-flash { animation: tag-flash .9s ease; }
@keyframes tag-flash { 0%, 100% { background: var(--brand-50); } 25% { background: var(--brand-200); } }

/* Lo oculto con el atributo hidden queda oculto aunque su clase defina display */
[hidden] { display: none !important; }

/* Sugerencias de la IA para una pregunta ("Sugerir con IA") */
.suggest-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.btn-suggest { color: var(--brand-700); border-color: var(--brand-200); background: var(--brand-50); }
.btn-suggest:hover { background: var(--brand-100); color: var(--brand-800); }
.suggest-box { display: grid; gap: 8px; padding: 10px 12px; border-radius: var(--radius); background: var(--gray-25); border: 1px solid var(--border); }
.suggest-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 12.5px; color: var(--text-2); }
.suggest-head button { border: 0; background: none; padding: 0; color: var(--brand-700); font: inherit; font-weight: 600; cursor: pointer; }
.suggest-head button:hover { text-decoration: underline; }
.suggest-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.suggest-chip { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 2px 10px; border: 1px dashed var(--brand-300); border-radius: 6px; background: var(--surface); color: var(--brand-700); font: 500 13px/1.3 var(--font); cursor: pointer; }
.suggest-chip:hover { background: var(--brand-50); border-style: solid; }
.suggest-msg { font-size: 12.5px; color: var(--text-3); }
.suggest-msg.is-error { color: var(--danger-700); }

/* "Opciones avanzadas" del formulario de búsqueda (cerrado por defecto) */
.advanced { scroll-margin-top: 20px; }
.advanced > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 20px 0 4px; padding: 14px 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--gray-800); font-size: 14px;
}
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary:hover { border-color: var(--brand-300); }
.advanced > summary .icon { transition: transform .15s; }
.advanced[open] > summary .icon { transform: rotate(180deg); }

/* Ajustes por secciones (estilo panel de configuración) */
.settings-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 32px; align-items: start; }
.settings-nav { position: sticky; top: 24px; display: grid; gap: 2px; }
.settings-nav a { padding: 6px 10px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; font-size: 13px; }
.settings-nav a:hover { background: var(--gray-100); color: var(--gray-900); text-decoration: none; }
.form-section { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; padding: 24px 0; border-bottom: 1px solid var(--border); scroll-margin-top: 20px; }
.form-section:first-child { padding-top: 0; }
.form-section-intro h2 { font-size: 15px; margin-bottom: 4px; }
.form-section-intro p { color: var(--text-2); font-size: 13px; margin: 0; }
.form-footer { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; gap: 8px; padding: 14px 0; margin-top: 8px; background: linear-gradient(180deg, rgba(247, 246, 246, 0) 0%, var(--bg) 35%); }

/* Carga de archivo */
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 22px 16px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--gray-25); text-align: center; cursor: pointer; transition: border-color .12s, background .12s; font-weight: 400; margin: 0; }
.dropzone:hover, .dropzone.is-drag { border-color: var(--brand-400); background: var(--brand-50); }
.dropzone .icon { width: 22px; height: 22px; color: var(--brand-600); }
.dropzone strong { color: var(--gray-900); font-weight: 600; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-name { font-size: 12.5px; color: var(--brand-700); font-weight: 550; }

/* Editor de experiencia */
.exp-editor { display: grid; gap: 10px; }
.exp-row { border: 1px solid var(--border); border-radius: var(--radius); padding: 0 14px 14px; background: var(--gray-25); display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px 12px; }
.exp-head { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -14px; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--border); }
.exp-title { font-weight: 600; font-size: 13px; color: var(--gray-800); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-row .full { grid-column: 1 / -1; }
.exp-row label { font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.exp-row input, .exp-row textarea { min-height: 32px; font-size: 13.5px; }
.exp-row textarea { min-height: 54px; }

/* --------------------------------------------------------------- Lists / misc */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--gray-100); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { min-width: 0; flex: 1; }
.kv { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; color: var(--gray-800); min-width: 0; }
.kv-stack { grid-template-columns: minmax(0, 1fr); gap: 3px; }
.kv-stack dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.kv-stack dd { margin-bottom: 12px; }
.kv-stack dd:last-child { margin-bottom: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--gray-100); color: var(--gray-700); font-size: 12px; font-weight: 500; }
.chip-brand { background: var(--brand-50); color: var(--brand-800); }
.empty { text-align: center; padding: 44px 20px; color: var(--text-2); }
.empty .empty-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--brand-50); color: var(--brand-600); display: grid; place-items: center; margin: 0 auto 12px; }
.empty h3 { margin-bottom: 4px; font-size: 15px; }
.empty p { color: var(--text-3); font-size: 13px; }
pre.log { background: var(--gray-900); color: #e9e3e4; border-radius: var(--radius); padding: 14px 16px; overflow: auto; font: 12px/1.6 var(--mono); max-height: 460px; white-space: pre-wrap; margin: 0; }
iframe.email-frame { width: 100%; height: 860px; border: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg); background: #f4f1f1; display: block; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-2); }

/* --------------------------------------------------------------- Auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-brand {
  background: var(--brand-900);
  background-image: radial-gradient(circle at 15% 10%, rgba(220, 156, 166, .18), transparent 45%), radial-gradient(circle at 90% 90%, rgba(168, 67, 79, .35), transparent 50%);
  color: #f3e6e8; padding: 48px 56px; display: flex; flex-direction: column;
}
.auth-brand .sidebar-brand { padding: 0; font-size: 17px; }
.auth-brand h2 { color: #fff; font-size: 30px; line-height: 1.2; font-weight: 650; letter-spacing: -.02em; max-width: 460px; margin-top: auto; }
.auth-brand p { color: #dcc3c7; max-width: 440px; font-size: 15px; margin-top: 14px; }
.auth-points { list-style: none; padding: 0; margin: 28px 0 auto; display: grid; gap: 12px; max-width: 440px; }
.auth-points li { display: flex; gap: 10px; align-items: flex-start; color: #ecdcdf; font-size: 14px; }
.auth-points .icon { color: var(--brand-300); margin-top: 2px; }
.auth-foot { color: #a8838a; font-size: 12.5px; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--surface); }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 24px; margin-bottom: 6px; }
.auth-card .subtitle { color: var(--text-2); margin-bottom: 24px; }
.auth-alt { margin-top: 18px; font-size: 13.5px; color: var(--text-2); text-align: center; }

/* --------------------------------------------------------------- Landing */
.site-header { position: sticky; top: 0; z-index: 10; background: rgba(255, 255, 255, .92); backdrop-filter: saturate(150%) blur(8px); border-bottom: 1px solid var(--border); }
.site-header .inner, .site-section .inner, .site-footer .inner, .hero .inner { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.site-header .inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.site-header .sidebar-brand { color: var(--gray-900); padding: 0; }
.site-nav { display: flex; gap: 22px; margin-left: 12px; }
.site-nav a { color: var(--text-2); font-weight: 500; font-size: 14px; }
.site-nav a:hover { color: var(--gray-900); text-decoration: none; }
.hero { padding: 72px 0 56px; background: linear-gradient(180deg, var(--brand-50) 0%, #fff 70%); }
.hero .inner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 56px; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--brand-700); background: #fff; border: 1px solid var(--brand-100); border-radius: 999px; padding: 4px 12px; }
.hero h1 { font-size: 44px; line-height: 1.1; letter-spacing: -.03em; font-weight: 700; margin: 18px 0 16px; }
.hero h1 em { font-style: normal; color: var(--brand-700); }
.hero .lead { font-size: 17px; color: var(--text-2); max-width: 520px; }
.hero .cta { display: flex; gap: 10px; margin-top: 28px; flex-wrap: wrap; }
.hero-note { margin-top: 14px; font-size: 13px; color: var(--text-3); }
.preview { border-radius: 14px; background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow-lg); overflow: hidden; }
.preview-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--gray-25); }
.preview-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--gray-200); display: block; }
.preview-bar span { margin-left: 10px; font-size: 12px; color: var(--text-3); }
.preview .offer { padding: 13px 16px; grid-template-columns: 76px minmax(0, 1fr) auto; }
.site-section { padding: 72px 0; }
.site-section.alt { background: var(--gray-50); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { max-width: 640px; margin-bottom: 36px; }
.section-head h2 { font-size: 28px; letter-spacing: -.02em; font-weight: 650; margin-bottom: 10px; }
.section-head p { color: var(--text-2); font-size: 15.5px; }
.feature { padding: 22px; }
.feature .f-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--brand-50); color: var(--brand-700); display: grid; place-items: center; margin-bottom: 14px; }
.feature h3 { font-size: 15px; margin-bottom: 6px; }
.feature p { color: var(--text-2); font-size: 13.5px; margin: 0; }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; counter-reset: step; }
.step { padding: 22px; position: relative; }
.step::before { counter-increment: step; content: "0" counter(step); font-weight: 700; font-size: 13px; color: var(--brand-600); letter-spacing: .04em; }
.step h3 { margin: 10px 0 6px; font-size: 15px; }
.step p { color: var(--text-2); font-size: 13.5px; margin: 0; }
.source-strip { display: flex; flex-wrap: wrap; gap: 10px; }
.source-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px; background: #fff; font-weight: 550; font-size: 13.5px; color: var(--gray-800); }
.cta-band { background: var(--brand-800); background-image: radial-gradient(circle at 85% 20%, rgba(220, 156, 166, .25), transparent 45%); border-radius: 18px; padding: 44px; display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; color: #f3e6e8; }
.cta-band h2 { color: #fff; font-size: 26px; letter-spacing: -.02em; }
.cta-band p { margin: 6px 0 0; color: #dcc3c7; }
.btn-light { background: #fff; color: var(--brand-800); border-color: #fff; }
.btn-light:hover { background: var(--brand-50); color: var(--brand-900); }
.site-footer { border-top: 1px solid var(--border); padding: 28px 0; color: var(--text-3); font-size: 13px; }
.site-footer .inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* --------------------------------------------------------------- Responsive */
@media (max-width: 1100px) {
  .layout-aside { grid-template-columns: minmax(0, 1fr); }
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { display: none; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero .inner { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(28, 24, 25, .4); z-index: 40; }
  .mobilebar { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 16px; background: var(--brand-950); color: #fff; position: sticky; top: 0; z-index: 30; }
  .mobilebar .sidebar-brand { padding: 0; font-size: 14px; }
  .mobilebar button { background: none; border: 0; color: #fff; padding: 6px; margin-left: -6px; cursor: pointer; display: grid; place-items: center; }
  .content { padding: 20px 16px 48px; }
  .grid-2, .grid-3, .form-row, .form-row-3, .steps { grid-template-columns: minmax(0, 1fr); }
  .form-section { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .offer { grid-template-columns: 68px minmax(0, 1fr); gap: 12px; }
  .offer .fit { width: 68px; font-size: 10.5px; }
  .offer-side { grid-column: 2; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .analysis { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-brand { display: none; }
  .site-nav { display: none; }
  .hero { padding: 44px 0 32px; }
  .hero h1 { font-size: 32px; }
  .exp-row { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv dd { margin-bottom: 8px; }
}
@media (max-width: 520px) {
  .grid-4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .stat-value { font-size: 22px; }
  .page-header .actions { width: 100%; }
  .cta-band { padding: 28px; }
}
