:root {
  --mc-primary: #4f46e5;
  --mc-bg: #f5f6fa;
}
body { background: var(--mc-bg); }

/* Landing */
.hero-gradient { background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.chat-preview .msg { max-width: 80%; padding: .5rem .85rem; border-radius: 1rem; margin-bottom: .5rem; font-size: .9rem; }
.chat-preview .in { background: #eef0f5; }
.chat-preview .out { background: var(--mc-primary); color: #fff; margin-left: auto; }
.auth-page { background: linear-gradient(135deg, #eef2ff 0%, #faf5ff 100%); }

/* App shell */
.app-shell { background: var(--mc-bg); }
.app-sidebar { width: 250px; min-height: 100vh; position: sticky; top: 0; display: flex; flex-direction: column; }
.app-sidebar .nav-link { color: #444; border-radius: .5rem; }
.app-sidebar .nav-link:hover { background: #f0f1f6; }
.app-sidebar .nav-link.active { background: var(--mc-primary); color: #fff; }
.app-main { min-height: 100vh; display: flex; flex-direction: column; }
.app-topbar { height: 60px; }
.app-content { flex-grow: 1; }

/* Inbox */
.inbox-wrapper { display: flex; height: calc(100vh - 60px); }
.inbox-list { width: 340px; display: flex; flex-direction: column; }
.conversations-scroll { overflow-y: auto; flex-grow: 1; }
.inbox-chat { flex-grow: 1; background: #eef0f5; }
.inbox-sidebar { width: 300px; display: flex; flex-direction: column; }
.inbox-sidebar-body { overflow-y: auto; flex-grow: 1; }
.sidebar-timeline-item { position: relative; padding-left: 1.25rem; margin-bottom: .75rem; }
.sidebar-timeline-item::before { content: ""; position: absolute; left: 0; top: .25rem; width: 8px; height: 8px; border-radius: 50%; background: #0d6efd; }
.sidebar-timeline-item::after { content: ""; position: absolute; left: 3.5px; top: 1rem; bottom: -.5rem; width: 1px; background: #e0e0e0; }
.sidebar-timeline-item:last-child::after { display: none; }
.chat-header { height: 64px; }
.conv-item { cursor: pointer; border-bottom: 1px solid #f0f0f0; }
.conv-item:hover, .conv-item.active { background: #eef2ff; }
.messages-scroll { overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .4rem; }
.bubble { max-width: 70%; padding: .5rem .8rem; border-radius: 1rem; font-size: .92rem; box-shadow: 0 1px 1px rgba(0,0,0,.05); }
.bubble.inbound { background: #fff; align-self: flex-start; border-bottom-left-radius: .25rem; }
.bubble.outbound { background: #d9fdd3; align-self: flex-end; border-bottom-right-radius: .25rem; }
.bubble .time { display: block; font-size: .68rem; color: #888; text-align: right; margin-top: 2px; }
.quick-replies-dropdown { position: absolute; bottom: 100%; left: 0; right: 0; background: #fff; border: 1px solid #dee2e6; border-radius: .375rem; box-shadow: 0 .5rem 1rem rgba(0,0,0,.15); max-height: 240px; overflow-y: auto; z-index: 1000; margin-bottom: 4px; }
.quick-reply-item { padding: .5rem .75rem; cursor: pointer; border-bottom: 1px solid #f0f0f0; }
.quick-reply-item:hover { background: #eef2ff; }
.quick-reply-item:last-child { border-bottom: none; }
.quick-reply-item .qr-shortcut { font-weight: 600; color: #0d6efd; font-size: .85rem; }
.quick-reply-item .qr-content { font-size: .8rem; color: #6c757d; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* WhatsApp QR */
.qr-box { width: 260px; height: 260px; border: 2px dashed #ccc; border-radius: 1rem; padding: 8px; }
.qr-box img { max-width: 100%; height: auto; }

/* Flow Editor (bot visual editor) */
.flow-canvas { background-image: radial-gradient(circle, #e0e0e0 1px, transparent 1px); background-size: 20px 20px; }
.flow-node { user-select: none; transition: box-shadow .15s; }
.flow-node:hover { box-shadow: 0 .25rem .75rem rgba(0,0,0,.15) !important; }
.flow-node-text { max-width: 160px; }
.flow-port:hover { background: #0d6efd !important; transform: translateX(-50%) scale(1.3); }
.flow-edit-panel .form-control-sm, .flow-edit-panel .form-select-sm { font-size: .8rem; }

/* Site Footer */
.site-footer { background: #1a1a2e; color: #c4c4c4; padding-top: 3rem; margin-top: auto; }
.site-footer a { color: #c4c4c4; text-decoration: none; transition: color .15s; }
.site-footer a:hover { color: #fff; }
.site-footer .footer-brand { font-size: 1.25rem; font-weight: 700; color: #fff; }
.site-footer h6 { color: #fff; font-weight: 600; }
.site-footer .social a { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.1); font-size: 1rem; }
.site-footer .social a:hover { background: rgba(255,255,255,.2); }
.site-footer .text-gold { color: #f0ad4e !important; }
.site-footer hr { border-color: rgba(255,255,255,.15); }
.site-footer .dev-name { color: #f0ad4e; font-weight: 600; }
.site-footer .dev-name:hover { color: #f0ad4e; text-decoration: underline; }
.site-footer .dev-socials a { font-size: .85rem; opacity: .8; }
.site-footer .dev-socials a:hover { opacity: 1; }

/* ==================== UX Enhancement Layer ==================== */

/* Toast notifications */
.mc-toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 9999; display: flex; flex-direction: column; gap: .5rem; max-width: 380px; }
.mc-toast { display: flex; align-items: flex-start; gap: .65rem; padding: .85rem 1rem; border-radius: .65rem; box-shadow: 0 .5rem 1.5rem rgba(0,0,0,.12); animation: mc-toast-in .25s ease; min-width: 300px; }
.mc-toast.success { background: #d1fae5; border-left: 4px solid #059669; }
.mc-toast.error { background: #fee2e2; border-left: 4px solid #dc2626; }
.mc-toast.info { background: #dbeafe; border-left: 4px solid #2563eb; }
.mc-toast.warning { background: #fef3c7; border-left: 4px solid #d97706; }
.mc-toast .mc-toast-icon { font-size: 1.25rem; flex-shrink: 0; margin-top: 1px; }
.mc-toast .mc-toast-body { flex-grow: 1; font-size: .9rem; color: #1f2937; }
.mc-toast .mc-toast-title { font-weight: 600; margin-bottom: 2px; }
.mc-toast .mc-toast-close { background: none; border: none; color: #6b7280; cursor: pointer; font-size: 1rem; padding: 0; line-height: 1; }
.mc-toast.removing { animation: mc-toast-out .2s ease forwards; }
@keyframes mc-toast-in { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes mc-toast-out { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(100%); } }

/* Loading button state */
.btn.is-loading { pointer-events: none; opacity: .75; }
.btn.is-loading .btn-text { visibility: hidden; }
.btn.is-loading::after { content: ""; position: absolute; width: 1rem; height: 1rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: mc-spin .5s linear infinite; left: 50%; top: 50%; margin-left: -.5rem; margin-top: -.5rem; }
@keyframes mc-spin { to { transform: rotate(360deg); } }

/* Empty states */
.mc-empty { text-align: center; padding: 3rem 1.5rem; }
.mc-empty .mc-empty-icon { font-size: 3.5rem; color: #c7c9d1; margin-bottom: 1rem; }
.mc-empty .mc-empty-title { font-size: 1.15rem; font-weight: 600; color: #374151; margin-bottom: .5rem; }
.mc-empty .mc-empty-desc { color: #6b7280; max-width: 420px; margin: 0 auto 1.5rem; font-size: .92rem; line-height: 1.5; }
.mc-empty .btn { min-width: 200px; }

/* Onboarding wizard */
.mc-wizard { max-width: 680px; margin: 0 auto; }
.mc-wizard-progress { display: flex; align-items: center; gap: 0; margin-bottom: 2rem; }
.mc-wizard-step { display: flex; align-items: center; gap: .5rem; flex: 1; }
.mc-wizard-step:last-child { flex: 0; }
.mc-wizard-step-dot { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: .9rem; flex-shrink: 0; transition: all .2s; }
.mc-wizard-step-dot.pending { background: #e5e7eb; color: #9ca3af; }
.mc-wizard-step-dot.active { background: var(--mc-primary); color: #fff; box-shadow: 0 0 0 4px rgba(79,70,229,.15); }
.mc-wizard-step-dot.done { background: #059669; color: #fff; }
.mc-wizard-step-line { flex: 1; height: 3px; background: #e5e7eb; margin: 0 .5rem; border-radius: 2px; transition: background .2s; }
.mc-wizard-step-line.done { background: #059669; }
.mc-wizard-step-label { font-size: .78rem; color: #6b7280; white-space: nowrap; }
.mc-wizard-step-label.active { color: var(--mc-primary); font-weight: 600; }

/* Onboarding checklist sidebar */
.mc-checklist { background: #fff; border-radius: .65rem; padding: 1rem 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.mc-checklist-item { display: flex; align-items: center; gap: .65rem; padding: .5rem 0; font-size: .88rem; cursor: pointer; transition: color .15s; }
.mc-checklist-item .bi { font-size: 1.1rem; }
.mc-checklist-item.pending { color: #6b7280; }
.mc-checklist-item.pending .bi { color: #d1d5db; }
.mc-checklist-item.done { color: #059669; text-decoration: line-through; }
.mc-checklist-item.done .bi { color: #059669; }
.mc-checklist-progress { height: 6px; background: #e5e7eb; border-radius: 3px; margin-bottom: .75rem; overflow: hidden; }
.mc-checklist-progress-bar { height: 100%; background: var(--mc-primary); border-radius: 3px; transition: width .3s ease; }

/* Dashboard intelligence cards */
.mc-stat-card { position: relative; overflow: hidden; }
.mc-stat-trend { display: inline-flex; align-items: center; gap: .25rem; font-size: .78rem; font-weight: 600; padding: .15rem .5rem; border-radius: 1rem; }
.mc-stat-trend.up { background: #d1fae5; color: #059669; }
.mc-stat-trend.down { background: #fee2e2; color: #dc2626; }
.mc-stat-trend.flat { background: #f3f4f6; color: #6b7280; }
.mc-stat-alert { display: flex; align-items: center; gap: .5rem; padding: .65rem .85rem; border-radius: .5rem; background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; font-size: .85rem; margin-top: .5rem; }
.mc-stat-alert .bi { font-size: 1rem; flex-shrink: 0; }

/* WhatsApp connection guide */
.mc-wa-guide { counter-reset: wa-step; }
.mc-wa-guide-step { display: flex; gap: 1rem; padding: .75rem 0; position: relative; }
.mc-wa-guide-step::before { counter-increment: wa-step; content: counter(wa-step); width: 32px; height: 32px; border-radius: 50%; background: var(--mc-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; flex-shrink: 0; }
.mc-wa-guide-step-content { padding-top: 4px; }
.mc-wa-guide-step-content h6 { margin-bottom: .15rem; font-size: .95rem; }
.mc-wa-guide-step-content p { margin: 0; font-size: .85rem; color: #6b7280; }
.mc-wa-guide-step:not(:last-child)::after { content: ""; position: absolute; left: 16px; top: 42px; bottom: 0; width: 2px; background: #e5e7eb; }

/* Form validation */
.form-control.is-invalid { border-color: #dc2626; }
.form-control.is-valid { border-color: #059669; }
.mc-field-feedback { font-size: .78rem; margin-top: .25rem; display: none; }
.mc-field-feedback.show { display: block; }
.mc-field-feedback.invalid { color: #dc2626; }
.mc-field-feedback.valid { color: #059669; }

/* Calendar */
.mc-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.mc-cal-dow { text-align: center; font-weight: 600; font-size: .75rem; color: #6b7280; padding: .5rem 0; }
.mc-cal-day { min-height: 80px; border: 1px solid #e5e7eb; border-radius: 8px; padding: 4px; cursor: pointer; transition: background .15s; }
.mc-cal-day:hover { background: #f9fafb; }
.mc-cal-day.mc-cal-empty { border: none; cursor: default; }
.mc-cal-day.mc-cal-today { background: #eff6ff; border-color: #3b82f6; }
.mc-cal-day-num { font-size: .8rem; font-weight: 600; color: #374151; margin-bottom: 2px; }
.mc-cal-event { font-size: .7rem; padding: 2px 6px; border-radius: 4px; margin-bottom: 2px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-cal-event-scheduled { background: #dbeafe; color: #1e40af; }
.mc-cal-event-confirmed { background: #d1fae5; color: #065f46; }
.mc-cal-event-completed { background: #f3f4f6; color: #6b7280; }
.mc-cal-event-cancelled { background: #fee2e2; color: #991b1b; }
.mc-cal-event-no_show { background: #fef3c7; color: #92400e; }

/* Smart alerts */
.mc-stat-alert { display: flex; align-items: center; gap: .5rem; padding: .6rem 1rem; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 10px; margin-bottom: .5rem; font-size: .85rem; color: #9a3412; }
.mc-stat-alert i { font-size: 1.1rem; }

/* Stat card trends */
.mc-stat-trend { font-size: .72rem; font-weight: 600; }
.mc-stat-trend.up { color: #059669; }
.mc-stat-trend.down { color: #dc2626; }
.mc-stat-trend.flat { color: #6b7280; }

/* AI feedback thumbs */
.mc-ai-feedback { display: inline-flex; gap: .25rem; }
.mc-ai-feedback button { border: none; background: none; font-size: 1.1rem; color: #9ca3af; cursor: pointer; transition: color .15s; }
.mc-ai-feedback button:hover { color: #6b7280; }
.mc-ai-feedback button.active.up { color: #059669; }
.mc-ai-feedback button.active.down { color: #dc2626; }

/* CRM Kanban */
.mc-kanban-col { flex-shrink: 0; width: 260px; background: #f8f9fa; border-radius: .5rem; border: 1px solid #e9ecef; display: flex; flex-direction: column; max-height: 70vh; }
.mc-kanban-col-header { padding: .5rem .75rem; border-radius: .5rem .5rem 0 0; display: flex; justify-content: space-between; align-items: center; }
.mc-kanban-col-total { padding: 0 .75rem .25rem; }
.mc-kanban-col-body { padding: .5rem; overflow-y: auto; flex-grow: 1; min-height: 80px; border-radius: 0 0 .5rem .5rem; }
.mc-kanban-col-body.mc-kanban-drag-over { background: #e3f2fd; border: 2px dashed #90caf9; }
.mc-kanban-empty { text-align: center; padding: 1.5rem .5rem; }
.mc-kanban-card { background: #fff; border: 1px solid #e9ecef; border-radius: .375rem; padding: .5rem .625rem; margin-bottom: .5rem; cursor: grab; transition: box-shadow .15s, opacity .15s; }
.mc-kanban-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.mc-kanban-card.mc-kanban-dragging { opacity: .5; cursor: grabbing; }
.mc-kanban-card-title { font-weight: 600; font-size: .875rem; margin-bottom: .125rem; }
.mc-kanban-card-value { margin-bottom: .25rem; }
.mc-kanban-card-meta { display: flex; justify-content: space-between; align-items: center; }
