* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f5f7fa; color: #1a2332; }

/* Login */
.login-wrap { max-width: 400px; margin: 100px auto; padding: 40px; background: #fff; border-radius: 16px; box-shadow: 0 8px 40px rgba(0,0,0,0.08); }
.login-wrap h1 { margin-bottom: 24px; color: #6c5ce7; }
.login-wrap input { width: 100%; padding: 12px; margin-bottom: 12px; border: 1px solid #d1d9e6; border-radius: 8px; font-size: 14px; }
.login-wrap button { width: 100%; padding: 12px; background: #6c5ce7; color: #fff; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #1a2332; color: #fff; padding: 24px 0; flex-shrink: 0; }
.sidebar .logo { padding: 0 24px 24px; font-size: 20px; font-weight: 800; color: #a29bfe; }
.sidebar nav a { display: block; padding: 10px 24px; color: #cbd5e0; text-decoration: none; font-size: 13px; border-left: 3px solid transparent; transition: all .15s; }
.sidebar nav a:hover, .sidebar nav a.active { background: rgba(108,92,231,.15); color: #fff; border-left-color: #6c5ce7; }
.main { flex: 1; padding: 28px; overflow-y: auto; max-height: 100vh; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.topbar h1 { font-size: 22px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-label { font-size: 13px; color: #6b7280; }
.topbar .logout { background: #eef0f4; color: #4a5568; border: none; padding: 8px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.card { background: #fff; padding: 18px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.card .label { font-size: 11px; text-transform: uppercase; color: #8892a6; font-weight: 600; margin-bottom: 4px; letter-spacing: .3px; }
.card .value { font-size: 26px; font-weight: 700; color: #1a2332; }
.card .value.highlight { color: #6c5ce7; }
.card .value.success { color: #10b981; }
.card .value.plan-badge { font-size: 18px; text-transform: capitalize; }

/* Tables */
.table { width: 100%; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.04); border-collapse: collapse; }
.table th, .table td { padding: 12px 14px; text-align: left; font-size: 13px; border-bottom: 1px solid #eef0f4; }
.table th { background: #f9fafb; font-size: 11px; text-transform: uppercase; color: #8892a6; font-weight: 600; }
.table tr:last-child td { border-bottom: none; }
.table tr.clickable:hover td { background: #f3f0ff; cursor: pointer; }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge.compro, .badge.activo { background: #d1fae5; color: #065f46; }
.badge.lead, .badge.pausado { background: #fef3c7; color: #92400e; }
.badge.sin_datos, .badge.cancelado { background: #e5e7eb; color: #4b5563; }

/* Buttons */
.btn { padding: 10px 16px; background: #6c5ce7; color: #fff; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; transition: opacity .15s; text-decoration: none; display: inline-block; }
.btn:hover { opacity: .85; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-secondary { background: #eef0f4; color: #4a5568; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-text { background: none; color: #9ca3af; font-weight: 400; text-decoration: underline; padding: 6px 0; }
.btn-text:hover { color: #ef4444; }
.btn-row { display: flex; gap: 8px; margin-top: 12px; }

/* Panels */
.panel { background: #fff; padding: 20px; border-radius: 12px; margin-bottom: 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.panel h2 { margin-bottom: 14px; font-size: 16px; }
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.panel-header h2 { margin-bottom: 0; }

/* Snippet */
.snippet-wrap { display: flex; align-items: center; gap: 10px; }
.snippet { flex: 1; background: #1a2332; color: #a29bfe; padding: 12px; border-radius: 8px; font-family: 'Courier New', monospace; font-size: 12px; overflow-x: auto; word-break: break-all; }

/* Messages */
.msg-list { display: flex; flex-direction: column; gap: 8px; max-height: 500px; overflow-y: auto; padding: 10px 0; }
.msg { max-width: 80%; padding: 10px 14px; border-radius: 12px; font-size: 14px; }
.msg.user { background: #6c5ce7; color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.assistant { background: #f3f4f6; align-self: flex-start; border-bottom-left-radius: 4px; }
.msg-role { font-size: 10px; font-weight: 600; text-transform: uppercase; margin-bottom: 4px; opacity: .7; }
.msg-text { white-space: pre-wrap; line-height: 1.5; }

/* Fields */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: #4a5568; }
.field input, .field select, .field textarea { width: 100%; padding: 10px; border: 1px solid #d1d9e6; border-radius: 8px; font-size: 14px; font-family: inherit; }
.field textarea { resize: vertical; }
.field input[type="checkbox"] { width: auto; margin-right: 6px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }

/* List items (FAQs, objeciones) */
.list-item { display: flex; justify-content: space-between; align-items: flex-start; padding: 12px; background: #f9fafb; border-radius: 8px; margin-bottom: 8px; gap: 12px; }
.list-item-content { flex: 1; }
.list-q { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.list-a { font-size: 13px; color: #4a5568; }

/* Plan cards */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.plan-card { background: #fff; padding: 24px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); text-align: center; border: 2px solid transparent; transition: border .2s; }
.plan-card.current { border-color: #6c5ce7; }
.plan-card.upgrade { border-color: #10b981; }
.plan-card h3 { font-size: 18px; margin-bottom: 8px; }
.plan-price { font-size: 32px; font-weight: 800; color: #1a2332; margin-bottom: 8px; }
.plan-price span { font-size: 14px; font-weight: 400; color: #8892a6; }
.plan-desc { font-size: 13px; color: #6b7280; margin-bottom: 16px; }
.plan-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Modal */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-content { background: #fff; padding: 28px; border-radius: 16px; max-width: 500px; width: 90%; max-height: 80vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.modal-content h2 { margin-bottom: 16px; }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; background: #fff; border-radius: 12px; }
.empty-state p { font-size: 16px; color: #4a5568; margin-bottom: 8px; }

/* Utils */
.loading { color: #8892a6; font-style: italic; }
.muted { color: #8892a6; font-size: 12px; }
.highlight { color: #6c5ce7; }
code { background: #f3f0ff; padding: 2px 6px; border-radius: 4px; font-size: 12px; color: #6c5ce7; }
strong { font-weight: 600; }
small { font-size: 11px; }
