/* SiteDesk · CSS — simple, friendly, neutral light theme with Atomo accent */
:root {
  --blue: #3b82f6;
  --blue-2: #60a5fa;
  --blue-soft: rgba(59,130,246,0.10);
  --purple: #8b5cf6;
  --grad: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);

  --bg: #fafaf9;
  --bg2: #ffffff;
  --bg3: #f4f4f1;
  --bg4: #ebeae5;
  --card: #ffffff;

  --text: #1a1a1f;
  --text2: #5a5a66;
  --muted: #8a8a96;
  --dim: #b0b0bc;

  --border: #e6e5e0;
  --border-strong: #d8d6cf;
  --border-blue: rgba(59,130,246,0.30);

  --success: #16a34a;
  --warning: #d97706;
  --error: #dc2626;
  --draft: #f59e0b;

  --sb-w: 240px;
  --top-h: 56px;
  --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08), 0 4px 8px rgba(0,0,0,0.04);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
.mono { font-family: 'JetBrains Mono', monospace; }

/* Layout */
.app { display: grid; grid-template-columns: var(--sb-w) 1fr; min-height: 100vh; }

/* Sidebar */
.sidebar {
  background: var(--bg2);
  border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
}
.sb-h {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  height: var(--top-h);
}
.sb-h .logo { width: 28px; height: 28px; flex-shrink: 0; }
.sb-h-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.sb-h-name small { display: block; font-size: 10px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 500; margin-top: 1px; }

.sb-site {
  margin: 12px 12px 4px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg3);
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
}
.sb-site-thumb {
  width: 28px; height: 28px; border-radius: 6px;
  background: linear-gradient(135deg, #fbbf24, #f87171);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}
.sb-site-meta { flex: 1; min-width: 0; }
.sb-site-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-site-url { font-size: 10.5px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.sb-site-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }

.sb-nav { flex: 1; padding: 10px 8px; }
.sb-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  margin-bottom: 2px;
  transition: background .12s, color .12s;
  user-select: none;
}
.sb-item:hover { background: var(--bg3); color: var(--text); }
.sb-item.active {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 600;
}
.sb-item .ico { width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sb-item .ico svg { width: 18px; height: 18px; }
.sb-item .badge {
  margin-left: auto;
  padding: 2px 7px; border-radius: 999px;
  background: var(--draft); color: white;
  font-size: 10.5px; font-weight: 700;
}

.sb-foot {
  border-top: 1px solid var(--border);
  padding: 12px;
  display: flex; align-items: center; gap: 10px;
}
.sb-foot-avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, #fbbf24, #f87171); color: white; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.sb-foot-meta { flex: 1; min-width: 0; }
.sb-foot-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-foot-role { font-size: 11px; color: var(--muted); }

/* Topbar */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--top-h);
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  display: flex; align-items: center;
  padding: 0 24px; gap: 14px;
  position: sticky; top: 0; z-index: 10;
}
.top-title { font-size: 16px; font-weight: 700; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* Drafts pill */
.drafts-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px 6px 8px;
  background: linear-gradient(135deg, rgba(245,158,11,0.10), rgba(245,158,11,0.06));
  border: 1px solid rgba(245,158,11,0.30);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--text);
  font-weight: 500;
}
.drafts-pill .num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px;
  border-radius: 999px;
  background: var(--draft); color: white;
  font-size: 11px; font-weight: 700; padding: 0 6px;
}

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  background: var(--bg3);
  color: var(--text);
  transition: background .15s, transform .12s;
}
.btn:hover { background: var(--bg4); }
.btn-primary { background: var(--grad); color: white; box-shadow: 0 4px 14px rgba(59,130,246,0.30); }
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-ghost { background: transparent; border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--bg3); }
.btn-success { background: var(--success); color: white; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 9px; background: transparent; }
.btn-icon:hover { background: var(--bg3); }

/* Content */
.content { padding: 28px; max-width: 1280px; width: 100%; }
.page-h { display: flex; align-items: flex-end; margin-bottom: 22px; }
.page-h h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.page-h p { font-size: 14px; color: var(--text2); margin-top: 4px; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-h h3 { font-size: 14.5px; font-weight: 700; flex: 1; }
.card-h .more { font-size: 13px; color: var(--blue); font-weight: 500; }
.card-h .more:hover { text-decoration: underline; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat { padding: 16px 18px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
.stat-label { font-size: 11px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.stat-num { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.stat-num.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-meta { margin-top: 8px; font-size: 11.5px; color: var(--text2); display: flex; align-items: center; gap: 5px; }

/* Quick actions */
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.quick-card {
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .15s;
  text-align: left;
}
.quick-card:hover { border-color: var(--border-blue); transform: translateY(-2px); box-shadow: var(--shadow); }
.quick-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--blue-soft);
  color: var(--blue);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.quick-title { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.quick-sub { font-size: 12px; color: var(--text2); line-height: 1.4; }

/* Preview frame */
.preview-frame {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.preview-bar {
  background: var(--bg3);
  padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.preview-dots { display: flex; gap: 5px; }
.preview-dots span { width: 9px; height: 9px; border-radius: 50%; background: rgba(0,0,0,0.10); }
.preview-dots span:nth-child(1) { background: #f87171; }
.preview-dots span:nth-child(2) { background: #fbbf24; }
.preview-dots span:nth-child(3) { background: #34d399; }
.preview-url { padding: 4px 12px; background: var(--bg2); border: 1px solid var(--border); border-radius: 6px; font-size: 11.5px; color: var(--text2); flex: 1; max-width: 320px; margin: 0 auto; text-align: center; }
.preview-body { aspect-ratio: 16 / 9; background: var(--bg3); position: relative; overflow: hidden; }

/* History timeline */
.timeline { display: flex; flex-direction: column; gap: 2px; }
.tl-item {
  display: flex; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.tl-item:last-child { border-bottom: 0; }
.tl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); margin-top: 7px; flex-shrink: 0; }
.tl-dot.ai { background: var(--purple); }
.tl-dot.draft { background: var(--draft); }
.tl-body { flex: 1; min-width: 0; }
.tl-msg { font-size: 13.5px; color: var(--text); margin-bottom: 3px; }
.tl-msg strong { font-weight: 600; }
.tl-meta { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.tl-meta .src { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 999px; background: rgba(139,92,246,0.10); color: var(--purple); font-weight: 600; font-size: 10.5px; }
.tl-meta .src.manual { background: var(--bg3); color: var(--text2); }
.tl-revert { font-size: 11.5px; color: var(--blue); font-weight: 600; }
.tl-revert:hover { text-decoration: underline; }

/* Chip */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg3);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 500;
  color: var(--text2);
}
.chip.draft { background: rgba(245,158,11,0.10); border-color: rgba(245,158,11,0.30); color: var(--draft); }
.chip.live { background: rgba(22,163,74,0.10); border-color: rgba(22,163,74,0.30); color: var(--success); }
.chip.ai { background: rgba(139,92,246,0.10); border-color: rgba(139,92,246,0.30); color: var(--purple); }

/* Product cards (módulo Productos) */
.product-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.product-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: border-color .15s, box-shadow .15s;
}
.product-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.product-img {
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
  position: relative;
}
.product-img-meat { background: linear-gradient(135deg, #fecaca, #fca5a5); }
.product-img-fish { background: linear-gradient(135deg, #bfdbfe, #93c5fd); }
.product-img-chicken { background: linear-gradient(135deg, #fef3c7, #fde68a); }
.product-img-veg { background: linear-gradient(135deg, #d1fae5, #a7f3d0); }
.product-toggle {
  position: absolute; top: 10px; right: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(6px);
  font-size: 10.5px; color: white; font-weight: 600;
}
.product-toggle.hidden { background: rgba(220,38,38,0.85); }
.product-body { padding: 14px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.product-name { font-size: 14px; font-weight: 600; line-height: 1.3; }
.product-desc { font-size: 12px; color: var(--text2); line-height: 1.4; flex: 1; }
.product-foot { display: flex; align-items: center; gap: 8px; padding-top: 10px; margin-top: 6px; border-top: 1px solid var(--border); }
.product-price {
  font-size: 16px; font-weight: 700; color: var(--text);
  padding: 4px 8px; border-radius: 6px;
  background: transparent;
  cursor: text;
}
.product-price:hover { background: var(--bg3); }
.product-actions { margin-left: auto; display: flex; gap: 2px; }

/* Form fields */
.form-row { display: grid; grid-template-columns: 200px 1fr; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); align-items: start; }
.form-row:last-child { border-bottom: 0; }
.form-label { font-size: 13.5px; font-weight: 600; padding-top: 8px; }
.form-label small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.input, .textarea {
  width: 100%;
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
.input:focus, .textarea:focus { border-color: var(--blue); }
.textarea { resize: vertical; min-height: 70px; line-height: 1.55; }

/* Chat */
.chat-layout { display: grid; grid-template-columns: 1fr 320px; gap: 24px; height: calc(100vh - var(--top-h) - 56px); }
.chat-main { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.chat-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.chat-stream { flex: 1; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 10px; }
.msg-avatar {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  background: var(--bg3);
  color: var(--text);
}
.msg-avatar.ai { background: var(--grad); color: white; }
.msg-body { flex: 1; min-width: 0; }
.msg-name { font-size: 11px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.msg-content { font-size: 14px; color: var(--text); line-height: 1.55; }

/* AI preview card */
.preview-card {
  margin-top: 10px;
  padding: 14px;
  background: var(--bg3);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
}
.preview-card-h { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.preview-card-h .icon { width: 22px; height: 22px; border-radius: 6px; background: rgba(139,92,246,0.15); color: var(--purple); display: flex; align-items: center; justify-content: center; }
.preview-card-h .label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--purple); }
.preview-diff { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.preview-from, .preview-to {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  font-size: 13px;
}
.preview-from .lbl, .preview-to .lbl { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 4px; }
.preview-from { opacity: 0.75; text-decoration: line-through; }
.preview-to { border-color: var(--border-blue); background: rgba(59,130,246,0.04); }
.preview-actions { display: flex; gap: 8px; }
.preview-actions .btn { padding: 7px 14px; font-size: 12.5px; }

/* Chat composer */
.chat-composer { padding: 14px 18px; border-top: 1px solid var(--border); background: var(--bg3); }
.chat-input {
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
}
.chat-input:focus-within { border-color: var(--blue); }
.chat-input input {
  flex: 1; background: transparent; border: 0; outline: 0;
  font-size: 14px; color: var(--text); font-family: inherit;
}
.chat-send {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--grad); color: white; border: 0;
  display: flex; align-items: center; justify-content: center;
}
.suggestions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.sug {
  padding: 5px 10px; border-radius: 999px;
  background: var(--bg2); border: 1px solid var(--border);
  font-size: 11.5px; color: var(--text2);
  cursor: pointer;
}
.sug:hover { background: var(--bg4); color: var(--text); }

/* Right rail */
.chat-rail { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.scope-card { padding: 14px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
.scope-h { font-size: 13px; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.scope-list { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text2); }
.scope-list .ok, .scope-list .no { display: flex; gap: 8px; align-items: flex-start; }
.scope-list .ok::before { content: '✓'; color: var(--success); font-weight: 700; flex-shrink: 0; }
.scope-list .no::before { content: '✗'; color: var(--dim); font-weight: 700; flex-shrink: 0; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 12px 20px;
  background: var(--text); color: var(--bg);
  border-radius: 12px;
  font-size: 13.5px; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
}
.toast .icon { color: var(--success); }

/* Responsive */
@media (max-width: 1024px) { .stats { grid-template-columns: 1fr 1fr; } .quick { grid-template-columns: 1fr 1fr; } .product-grid { grid-template-columns: 1fr 1fr; } .chat-layout { grid-template-columns: 1fr; } .chat-rail { display: none; } }
@media (max-width: 720px) { :root { --sb-w: 0; } .sidebar { display: none; } .content { padding: 20px; } .stats, .quick, .product-grid { grid-template-columns: 1fr; } .form-row { grid-template-columns: 1fr; gap: 8px; } }
