/* Central de Negocios Villarufke — diseno 2026.
   Sin build ni frameworks: variables, capas suaves y movimiento contenido. */
:root {
  --brand: #064e3b;
  --brand-2: #0f766e;
  --brand-3: #14b8a6;
  --accent: #f59e0b;
  --accent-ink: #3b2400;
  --bg: #f3f7f5;
  --bg-2: #e8f1ed;
  --surface: #ffffff;
  --surface-2: #f6faf8;
  --surface-3: #eaf3ef;
  --ink: #10211c;
  --muted: #5d726b;
  --line: #d8e6e0;
  --ok: #0f7a4d;
  --err: #c0392b;
  --info: #1d4ed8;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px #052e2110, 0 8px 24px #052e2108;
  --shadow: 0 18px 50px #052e211a;
  --ring: 0 0 0 4px #14b8a62e;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(900px 480px at 8% -8%, #14b8a61f, transparent 60%),
    radial-gradient(760px 420px at 100% 0%, #f59e0b18, transparent 55%),
    linear-gradient(180deg, var(--bg), #f8fbfa 40%, var(--bg));
  background-attachment: fixed;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
::selection { background: #14b8a63d; }
h1 { font-size: clamp(24px, 3vw, 32px); letter-spacing: -.02em; margin: 0 0 8px; }
h2 { font-size: 20px; letter-spacing: -.01em; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 14px 0 6px; }
p { line-height: 1.55; }
a { color: var(--brand-2); }
.muted { color: var(--muted); font-weight: 400; }
.ok { color: var(--ok); }
.error { color: var(--err); }
.hidden { display: none !important; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 28px 16px 36px; }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px clamp(14px, 3vw, 28px);
  color: #fff;
  background: linear-gradient(115deg, #042f25, #064e3b 45%, #0b6152 74%, #042f25);
  background-size: 180% 180%;
  box-shadow: 0 10px 30px #042f2533;
  animation: barShift 22s ease infinite;
}
@keyframes barShift { 0%, 100% { background-position: 0% 45%; } 50% { background-position: 100% 55%; } }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -.01em; }
.topbar .brand img { height: 40px; width: auto; filter: drop-shadow(0 4px 12px #0004); }
.tag {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  background: #f59e0b;
  color: var(--accent-ink);
  padding: 4px 9px;
  border-radius: 999px;
}
.session { display: flex; align-items: center; gap: 10px; font-size: 13px; flex-wrap: wrap; justify-content: flex-end; }
.session .btn { padding: 8px 12px; }
.sitepick { display: inline-flex; align-items: center; gap: 6px; }
.sitepick select {
  width: auto;
  min-width: 150px;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid #ffffff33;
  border-radius: 999px;
  background: #ffffff1f;
  color: #fff;
  font-size: 12px;
}
.sitepick select option { color: var(--ink); }
#bell { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 999px; background: #ffffff14; }
#bell:hover { background: #ffffff24; }
.badge-count { background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 999px; }
.agent-launch {
  border: 1px solid #ffffff3d;
  background: #ffffff18;
  color: #fff;
  font-weight: 700;
}
.agent-launch:hover { background: #ffffff2b; }

/* ---------- Layout ---------- */
main { max-width: 1180px; margin: 22px auto; padding: 0 clamp(12px, 3vw, 24px) 56px; }

/* ---------- Navegacion ---------- */
.pills {
  position: sticky;
  top: 68px;
  z-index: 30;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0 0 18px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffffd9;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-sm);
}
.pill {
  border: 1px solid transparent;
  background: transparent;
  color: #28453c;
  padding: 9px 13px;
  border-radius: 11px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .18s, color .18s, transform .18s, box-shadow .18s;
}
.pill:hover { background: var(--surface-3); transform: translateY(-1px); }
.pill.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 8px 18px #064e3b38;
}
.pill#refresh { margin-left: auto; border-color: var(--line); background: #fff; }

/* ---------- Tarjetas ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(16px, 2.2vw, 24px);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #c6dbd3; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 16px; }
.grid .card { margin-bottom: 0; height: 100%; }
.auth { max-width: 470px; margin: clamp(20px, 6vh, 60px) auto; text-align: center; border-radius: var(--radius-lg); }
.auth h1 { color: var(--brand); }
.auth .btn.primary { width: 100%; margin-top: 10px; }

/* ---------- Hero del panel ---------- */
.hero-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(22px, 4vw, 34px);
  border-radius: var(--radius-lg);
  color: #fff;
  background:
    radial-gradient(420px 220px at 88% 10%, #14b8a655, transparent 70%),
    radial-gradient(320px 180px at 4% 100%, #f59e0b33, transparent 70%),
    linear-gradient(125deg, #042f25, #075e4c 58%, #0f766e);
  box-shadow: 0 24px 60px #052e2138;
  margin-bottom: 18px;
}
.hero-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(#ffffff0c 1px, transparent 1px), linear-gradient(90deg, #ffffff0c 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(120deg, #000, transparent 78%);
  pointer-events: none;
}
.hero-panel .kicker { color: #a7f3d0; }
.hero-panel h1 { color: #fff; max-width: 760px; }
.hero-panel p { color: #d1fae5; max-width: 720px; margin: 0 0 16px; }
.hero-panel .btn.primary { background: #fff; color: var(--brand); border-color: #fff; }
.hero-panel .btn { background: #ffffff1c; border-color: #ffffff3d; color: #fff; }
.kicker { display: inline-block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .11em; color: var(--brand-2); margin-bottom: 6px; }

/* ---------- KPIs y onboarding ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 16px 0 0; }
.kpi {
  padding: 13px 14px;
  border-radius: 12px;
  background: #ffffff12;
  border: 1px solid #ffffff2e;
}
.kpi b { display: block; font-size: 24px; line-height: 1.1; }
.kpi span { font-size: 11px; color: #c7f9e5; }
.onboard { display: grid; gap: 10px; }
.onboard-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.onboard-step .dot {
  flex: 0 0 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
}
.onboard-step.done .dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.onboard-step strong { display: block; font-size: 13px; }
.onboard-step small { color: var(--muted); }
.onboard-step .btn { margin-left: auto; align-self: center; padding: 7px 10px; font-size: 12px; }
.progress { height: 9px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: 10px 0 14px; }
.progress > div { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand-2), var(--brand-3)); transition: width .5s ease; }

/* ---------- Formularios ---------- */
input, select, textarea {
  width: 100%;
  padding: 11px 12px;
  margin: 6px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
input:hover, select:hover, textarea:hover { border-color: #bdd4cc; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-3); box-shadow: var(--ring); }
input[type="color"] { padding: 3px; height: 42px; cursor: pointer; }
input[type="checkbox"] { accent-color: var(--brand-2); }
label { display: block; font-size: 13px; font-weight: 650; margin-top: 10px; color: #25443a; }
label.req::after { content: " *"; color: var(--err); font-weight: 800; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: auto; margin: 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 150px; min-width: 0; }
.row .btn { flex: 0 0 auto; }
.reqmark { color: var(--err); font-weight: 800; }
.invalid, input.invalid, select.invalid, textarea.invalid { border: 2px solid var(--err) !important; background: #fff5f5; }
.fielderr { color: var(--err); font-size: 12px; min-height: 16px; display: block; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 10px 15px;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
  line-height: 1.2;
  transition: transform .15s ease, box-shadow .2s ease, background .2s, border-color .2s;
}
.btn:hover { transform: translateY(-1px); border-color: #bdd4cc; box-shadow: 0 8px 18px #052e2114; }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .6; cursor: wait; transform: none; }
.btn.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 20px #064e3b2e;
}
.btn.primary:hover { box-shadow: 0 12px 26px #064e3b40; }
.btn.danger { color: var(--err); border-color: #f0c4bf; background: #fff8f7; }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 10px; font-size: 12px; }
.btn.wide { width: 100%; }

/* ---------- Items, badges y piezas ---------- */
.item {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 12px;
  margin: 8px 0;
  background: #fff;
  font-size: 14px;
  transition: background .15s, border-color .15s;
}
.item:hover { background: var(--surface-2); border-color: #c6dbd3; }
.item small { color: var(--muted); }
.item .ops { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.badge { display: inline-block; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 3px 7px; border-radius: 999px; background: var(--surface-3); color: var(--brand); }
.badge.idea { background: #fff3d6; color: #7a4a00; }
.badge.listo { background: #dbeafe; color: #1e40af; }
.badge.publicado { background: #d1fae5; color: #065f46; }
.piece { margin: 10px 0; }
.piece .body { white-space: pre-wrap; margin: 8px 0; font-size: 13px; line-height: 1.55; color: #24443a; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.chip {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--brand);
  padding: 8px 11px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  transition: all .16s;
}
.chip:hover { background: var(--brand); border-color: var(--brand); color: #fff; transform: translateY(-1px); }

/* ---------- Chat y agente ---------- */
.chat {
  border: 1px solid var(--line);
  border-radius: 12px;
  height: 260px;
  overflow-y: auto;
  padding: 12px;
  margin-bottom: 8px;
  background: linear-gradient(180deg, #fbfdfc, #f3f8f6);
}
.msg { margin: 7px 0; padding: 9px 13px; border-radius: 14px; max-width: 86%; font-size: 14px; white-space: pre-line; line-height: 1.5; }
.msg.me { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.msg.bot { background: #e6f0ec; border-bottom-left-radius: 4px; }
.agent-chat { height: min(46vh, 420px); }

/* ---------- Cajon del agente ---------- */
.backdrop { position: fixed; inset: 0; background: #042f2566; backdrop-filter: blur(3px); z-index: 70; animation: fadeIn .2s ease; }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 80;
  width: min(440px, 100vw);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #fbfdfc;
  box-shadow: -20px 0 70px #042f2540;
  animation: drawerIn .28s cubic-bezier(.2, .8, .2, 1);
}
@keyframes drawerIn { from { transform: translateX(100%); } to { transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.drawer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  color: #fff;
  background: linear-gradient(125deg, #042f25, var(--brand-2));
}
.drawer-head h2 { margin: 0; font-size: 17px; }
.drawer-head .btn { margin-left: auto; background: #ffffff18; border-color: #ffffff3d; color: #fff; }
.drawer-body { padding: 16px 18px 22px; overflow-y: auto; flex: 1; }
.agent-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 18px;
  cursor: pointer;
  font-size: 24px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-3));
  box-shadow: 0 16px 36px #064e3b52, inset 0 1px 0 #ffffff55;
  transition: transform .2s, box-shadow .2s;
}
.fab:hover { transform: translateY(-3px) rotate(-4deg); box-shadow: 0 22px 46px #064e3b66; }

/* ---------- Scores, barras y calendario ---------- */
.score { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 10px 0; color: var(--brand); }
.bar { height: 10px; background: var(--surface-3); border-radius: 999px; overflow: hidden; margin: 8px 0 16px; }
.bar > div { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand-2), var(--brand-3)); transition: width .6s ease; }
.seo-row { display: flex; gap: 9px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.seo-row:last-child { border-bottom: 0; }
.seo-row input { width: auto; margin: 2px 0 0; }
.cal { display: grid; grid-template-columns: 52px repeat(7, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; font-size: 12px; margin-top: 10px; }
.cal > div { background: #fff; min-height: 22px; }
.cal .hd { font-weight: 750; text-align: center; padding: 7px 2px; background: var(--surface-3); }
.cal .hd.today { background: var(--brand); color: #fff; }
.cal .hr { color: var(--muted); text-align: right; padding: 2px 4px; }
.cal .day { position: relative; cursor: crosshair; }
.cal .ev { position: absolute; left: 2px; right: 2px; background: var(--brand-2); color: #fff; border-radius: 6px; padding: 2px 4px; font-size: 11px; overflow: hidden; cursor: pointer; }
.cal .ev.cancelled { background: #94a3b8; text-decoration: line-through; }

/* ---------- Campana, toasts y avisos ---------- */
#bell-panel {
  position: fixed;
  top: 72px;
  right: 16px;
  width: min(360px, calc(100vw - 32px));
  max-height: 64vh;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 60;
  padding: 14px;
}
#bell-panel .item { cursor: pointer; }
#bell-panel .item:hover { background: var(--surface-2); }
#toasts { position: fixed; top: 82px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 90; max-width: min(360px, calc(100vw - 32px)); }
.toast {
  background: #0b3d31;
  color: #fff;
  padding: 12px 15px;
  border-radius: 12px;
  font-size: 13px;
  box-shadow: 0 12px 30px #042f2540;
  cursor: pointer;
  animation: slidein .25s ease-out;
}
.toast.ok { background: var(--ok); }
.toast.error { background: var(--err); }
.toast.info { background: var(--info); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Vistas ---------- */
.view { animation: fadeUp .32s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
.tabs { display: flex; gap: 8px; justify-content: center; margin: 16px 0; }
.tab { border: 1px solid var(--line); background: #fff; padding: 9px 18px; border-radius: 999px; cursor: pointer; font: inherit; font-weight: 650; }
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.empty { text-align: center; padding: 22px; border: 1px dashed #c6dbd3; border-radius: 12px; color: var(--muted); background: var(--surface-2); }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .pills { position: static; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .pills::-webkit-scrollbar { display: none; }
  .pill#refresh { margin-left: 0; }
}
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; padding: 10px 14px; }
  .brand .tag { display: none; }
  .session { width: 100%; justify-content: space-between; }
  .sitepick { order: 3; width: 100%; }
  .sitepick select { width: 100%; }
  main { margin-top: 12px; padding-bottom: 92px; }
  .grid { grid-template-columns: 1fr; }
  .row { flex-direction: column; align-items: stretch; }
  .row > * { flex: 1 1 auto; }
  .row .btn { width: 100%; }
  .drawer { width: 100vw; }
  .fab { right: 16px; bottom: 16px; }
  .hero-panel { border-radius: 16px; }
  .cal { font-size: 10px; grid-template-columns: 40px repeat(7, 1fr); }
  #bell-panel { top: 96px; }
  #toasts { top: 100px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
