:root {
  --brand: #3F87FC;
  --brand-dark: #2563EB;
  --brand-soft: #EFF6FF;
  --ink: #111827;
  --muted: #64748B;
  --surface: #FFFFFF;
  --canvas: #F5F8FC;
  --border: #E5E7EB;
  --success: #16A34A;
  --warning: #D97706;
  --danger: #DC2626;
  --sidebar: 272px;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; }
a { color: var(--brand-dark); text-decoration: none; }
a:hover { color: #1D4ED8; }
.btn { min-height: 42px; border-radius: 10px; font-weight: 650; padding-inline: 1rem; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; }
.btn-sm { min-height: 34px; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark); }
.btn-soft-primary { background: var(--brand-soft); color: var(--brand-dark); border: 1px solid #D6E6FF; }
.btn-soft-primary:hover { background: #DBEAFE; color: #1D4ED8; }
.form-control, .form-select { min-height: 44px; border-color: var(--border); border-radius: 10px; color: var(--ink); }
textarea.form-control { min-height: 120px; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .22rem rgba(63, 135, 252, .14); }
.form-label { font-weight: 650; color: #334155; margin-bottom: .45rem; }
.form-text { color: var(--muted); }

.app-sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: #111827; color: #CBD5E1; z-index: 1040; display: flex; flex-direction: column; transition: transform .24s ease; }
.brand-block { padding: 24px 22px 20px; border-bottom: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 43px; height: 43px; flex: 0 0 43px; background: var(--brand); color: #fff; border-radius: 13px; display: grid; place-items: center; font-size: 21px; box-shadow: 0 7px 20px rgba(63,135,252,.28); }
.brand-name { color: #fff; font-size: 15px; line-height: 1.2; font-weight: 750; }
.brand-subtitle { color: #94A3B8; font-size: 11px; margin-top: 4px; }
.sidebar-nav { overflow-y: auto; padding: 14px 12px; flex: 1; scrollbar-width: thin; }
.nav-section { color: #64748B; font-size: 10px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; padding: 14px 12px 7px; }
.sidebar-link { min-height: 43px; color: #CBD5E1; display: flex; align-items: center; gap: 12px; padding: 9px 12px; margin: 3px 0; border-radius: 10px; font-weight: 560; transition: background .16s ease, color .16s ease; }
.sidebar-link i { font-size: 17px; width: 20px; text-align: center; }
.sidebar-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-link.active { background: var(--brand); color: #fff; box-shadow: 0 8px 18px rgba(63,135,252,.22); }
.sidebar-footer { padding: 14px 12px 18px; border-top: 1px solid rgba(255,255,255,.08); }
.emergency-btn { width: 100%; border: 1px solid rgba(248,113,113,.38); color: #FCA5A5; background: rgba(220,38,38,.09); }
.emergency-btn:hover { background: #DC2626; color: #fff; }

.app-main { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.app-topbar { height: 76px; padding: 0 30px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 1020; backdrop-filter: blur(10px); }
.page-heading { font-size: 20px; font-weight: 750; margin: 0; letter-spacing: -.02em; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.wa-pill { height: 36px; padding: 0 12px; border: 1px solid var(--border); background: #fff; border-radius: 999px; display: flex; align-items: center; gap: 8px; color: #475569; font-weight: 650; font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #EF4444; box-shadow: 0 0 0 4px rgba(239,68,68,.1); }
.status-dot.connected { background: #22C55E; box-shadow: 0 0 0 4px rgba(34,197,94,.1); }
.topbar-icon { border: 1px solid var(--border); background: #fff; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: #475569; }
.avatar { width: 38px; height: 38px; border-radius: 11px; background: var(--brand-soft); color: var(--brand-dark); display: grid; place-items: center; font-weight: 800; }
.mobile-menu { display: none; }
.content-wrap { flex: 1; padding: 28px 30px 36px; width: 100%; max-width: 1720px; margin: 0 auto; }
.app-footer { color: #94A3B8; font-size: 12px; text-align: center; padding: 18px 30px 24px; }
.app-footer small { display: block; margin-top: 4px; }

.card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { background: #fff; border-bottom: 1px solid var(--border); padding: 19px 22px; border-radius: var(--radius) var(--radius) 0 0 !important; }
.card-body { padding: 22px; }
.section-title { font-size: 16px; font-weight: 750; margin: 0; }
.section-subtitle { color: var(--muted); font-size: 13px; margin-top: 4px; }
.page-intro { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 22px; }
.page-intro h2 { font-size: 25px; font-weight: 780; margin: 0 0 5px; letter-spacing: -.025em; }
.page-intro p { color: var(--muted); margin: 0; }

.stat-card { padding: 20px; height: 100%; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat-card::after { content: ''; position: absolute; width: 70px; height: 70px; border-radius: 50%; right: -28px; top: -28px; background: var(--brand-soft); }
.stat-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 19px; margin-bottom: 17px; }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 680; text-transform: uppercase; letter-spacing: .045em; }
.stat-value { font-size: 27px; font-weight: 800; margin-top: 4px; letter-spacing: -.03em; }
.stat-meta { color: var(--muted); margin-top: 3px; font-size: 12px; }
.stat-card.success .stat-icon { background: #ECFDF5; color: var(--success); }
.stat-card.warning .stat-icon { background: #FFFBEB; color: var(--warning); }
.stat-card.danger .stat-icon { background: #FEF2F2; color: var(--danger); }

.table { margin: 0; color: #334155; }
.table > :not(caption) > * > * { border-bottom-color: #EEF2F7; padding: .9rem .85rem; vertical-align: middle; }
.table thead th { color: #64748B; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 750; background: #F8FAFC; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FBFDFF; }
.badge { font-weight: 700; padding: .42rem .62rem; border-radius: 999px; letter-spacing: .01em; }
.badge-status-sent, .badge-status-server_ack, .badge-status-delivered, .badge-status-read, .badge-status-played, .badge-status-connected, .badge-status-completed, .badge-status-active, .badge-status-confirmed { background: #DCFCE7; color: #15803D; }
.badge-status-failed, .badge-status-error, .badge-status-stopped, .badge-status-opted_out, .badge-status-inactive, .badge-status-cancelled { background: #FEE2E2; color: #B91C1C; }
.badge-status-pending, .badge-status-accepted, .badge-status-paused, .badge-status-unknown, .badge-status-skipped { background: #FEF3C7; color: #B45309; }
.badge-status-running, .badge-status-processing, .badge-status-draft, .badge-status-queued { background: #DBEAFE; color: #1D4ED8; }
.pagination .page-link { color: var(--brand-dark); border-color: var(--border); min-width: 38px; text-align: center; }
.pagination .active .page-link { background: var(--brand); border-color: var(--brand); }

.empty-state { text-align: center; padding: 55px 24px; }
.empty-icon { width: 68px; height: 68px; margin: 0 auto 18px; border-radius: 20px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 29px; }
.empty-state h3 { font-size: 18px; font-weight: 750; }
.empty-state p { color: var(--muted); max-width: 390px; margin: 8px auto 20px; }
.alert { border: 0; border-radius: 12px; }
.progress { height: 10px; background: #E8EEF7; border-radius: 999px; }
.progress-bar { background: var(--brand); border-radius: 999px; }
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-item { display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px solid #EEF2F7; }
.activity-item:last-child { border-bottom: 0; }
.activity-dot { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--brand); flex: 0 0 8px; }
.activity-time { color: #94A3B8; font-size: 11px; }

.device-shell { max-width: 920px; margin: 0 auto; }
.device-hero { text-align: center; padding: 34px 24px 20px; }
.device-icon { width: 76px; height: 76px; border-radius: 23px; display: grid; place-items: center; margin: 0 auto 18px; background: var(--brand-soft); color: var(--brand); font-size: 35px; }
.qr-frame { width: 368px; max-width: 100%; min-height: 368px; margin: 20px auto; border: 2px solid #D6E6FF; border-radius: 22px; padding: 13px; display: grid; place-items: center; background: #fff; position: relative; }
.qr-frame::before, .qr-frame::after { content: ''; position: absolute; width: 46px; height: 46px; border-color: var(--brand); border-style: solid; }
.qr-frame::before { left: -2px; top: -2px; border-width: 4px 0 0 4px; border-radius: 20px 0 0 0; }
.qr-frame::after { right: -2px; bottom: -2px; border-width: 0 4px 4px 0; border-radius: 0 0 20px 0; }
.qr-frame img { max-width: 100%; border-radius: 10px; }
.pairing-card { max-width: 620px; margin-inline: auto; border: 2px solid #D6E6FF; border-radius: 22px; padding: 28px; background: linear-gradient(145deg, #F8FBFF, #FFFFFF); }
.pairing-code { margin: 12px 0; color: var(--brand); font-size: clamp(2rem, 8vw, 3.4rem); font-weight: 800; letter-spacing: .12em; line-height: 1; font-variant-numeric: tabular-nums; }
.method-icon { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 12px; display: grid; place-items: center; color: var(--brand); background: #EAF2FF; font-size: 1.25rem; }
.diagnostic-results { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.instruction-list { counter-reset: steps; list-style: none; padding: 0; margin: 0; }
.instruction-list li { counter-increment: steps; display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.instruction-list li::before { content: counter(steps); width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-dark); font-weight: 800; }

.wizard-steps { display: grid; grid-template-columns: repeat(5,1fr); margin-bottom: 22px; gap: 8px; }
.wizard-step-label { position: relative; text-align: center; color: #94A3B8; font-weight: 650; font-size: 12px; }
.wizard-step-label span { width: 34px; height: 34px; margin: 0 auto 7px; background: #E2E8F0; color: #64748B; display: grid; place-items: center; border-radius: 50%; position: relative; z-index: 1; }
.wizard-step-label.active, .wizard-step-label.done { color: var(--brand-dark); }
.wizard-step-label.active span, .wizard-step-label.done span { background: var(--brand); color: #fff; }
.wizard-panel { display: none; }
.wizard-panel.active { display: block; }
.message-preview { white-space: pre-wrap; background: #E7FFDB; border-radius: 12px 12px 3px 12px; padding: 14px 16px; max-width: 440px; box-shadow: 0 2px 4px rgba(15,23,42,.07); }
.min-w-0 { min-width: 0; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 22px; align-items: start; }
.template-card { min-width: 0; overflow: hidden; }
.template-card .card-body { min-width: 0; overflow: hidden; }
.template-media-frame { position: relative; width: 100%; max-width: 100%; aspect-ratio: 16 / 9; min-height: 180px; max-height: 300px; display: grid; place-items: center; overflow: hidden; border-radius: 14px; background: #0F172A; border: 1px solid #1E293B; }
.template-media-frame img, .template-media-frame video { display: block; width: 100%; height: 100%; max-width: 100%; max-height: 300px; object-fit: contain; }
.template-media { width: 100%; max-width: 100%; overflow: hidden; }
.template-media img, .template-media video { display: block; width: 100%; max-width: 100%; max-height: 300px; object-fit: contain; border-radius: 13px; background: #0F172A; }
.template-media-name { min-width: 0; display: flex; gap: 7px; align-items: center; color: var(--muted); font-size: 12px; padding: 8px 2px 13px; }
.template-message { max-width: 100%; overflow-wrap: anywhere; }
.upload-preview { width: 100%; max-width: 480px; height: 240px; margin-top: 12px; overflow: hidden; display: grid; place-items: center; border-radius: 13px; background: #0F172A; }
.upload-preview img, .upload-preview video { width: 100%; height: 100%; object-fit: contain; }
.bulk-toolbar { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.bulk-toolbar .form-select { width: auto; min-width: 150px; min-height: 34px; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 999px; font-size: 12px; text-transform: capitalize; }
.status-pill .status-dot { box-shadow: none; }
.status-connected { background: #ECFDF5; color: #15803D; }
.status-connected .status-dot { background: #22C55E; }
.status-neutral { background: #F1F5F9; color: #64748B; }
.status-neutral .status-dot { background: #94A3B8; }
.content-wrap:has(.wa-web-shell) { max-width: none; padding: 18px 20px 20px; min-height: 0; }
.app-main:has(.wa-web-shell) .app-footer { display: none; }
.wa-web-shell { --wa-green: #00A884; --wa-green-dark: #008069; height: calc(100vh - 114px); min-height: 620px; display: grid; grid-template-columns: minmax(310px, 360px) minmax(440px, 1fr) 0; position: relative; overflow: hidden; background: #fff; border: 1px solid #DDE3E8; border-radius: 14px; box-shadow: 0 14px 40px rgba(15,23,42,.1); transition: grid-template-columns .2s ease; }
.wa-web-shell.details-open { grid-template-columns: minmax(310px, 360px) minmax(440px, 1fr) minmax(300px, 340px); }
.wa-inbox-panel, .wa-conversation-panel, .wa-details-panel { min-width: 0; min-height: 0; }
.wa-inbox-panel { display: flex; flex-direction: column; border-right: 1px solid #DDE3E8; background: #fff; }
.wa-panel-header, .wa-conversation-header, .wa-details-header { min-height: 64px; padding: 10px 14px; display: flex; align-items: center; background: #F0F2F5; border-bottom: 1px solid #E4E9ED; }
.wa-panel-header h2 { margin: 0; font-size: 21px; font-weight: 780; letter-spacing: -.02em; }
.wa-panel-header small { display: block; margin-top: 1px; color: #667781; font-size: 11px; }
.wa-header-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.wa-icon-btn { width: 40px; height: 40px; min-height: 0; padding: 0; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: #54656F; font-size: 18px; }
.wa-icon-btn:hover, .wa-icon-btn:focus-visible { color: #111B21; background: #E1E5E8; }
.wa-icon-btn:disabled { opacity: .4; }
.wa-inbox-search { height: 52px; margin: 0; padding: 7px 12px; position: relative; display: flex; align-items: center; border-bottom: 1px solid #F0F2F5; }
.wa-inbox-search > i { position: absolute; left: 27px; color: #667781; font-size: 14px; }
.wa-inbox-search input { width: 100%; height: 38px; padding: 0 40px 0 43px; border: 0; outline: 0; border-radius: 9px; background: #F0F2F5; color: #111B21; font-size: 13px; }
.wa-inbox-search a { position: absolute; right: 24px; color: #667781; }
.wa-chat-filters { padding: 7px 12px 9px; display: flex; gap: 6px; overflow-x: auto; border-bottom: 1px solid #F0F2F5; scrollbar-width: none; }
.wa-chat-filters a { flex: 0 0 auto; padding: 6px 11px; border-radius: 999px; color: #54656F; background: #F0F2F5; font-size: 12px; font-weight: 650; }
.wa-chat-filters a.active { color: #008069; background: #E7FCE9; }
.wa-chat-row-labels { display: flex; gap: 4px; margin-top: 3px; overflow: hidden; }
.wa-chat-row-labels small { flex: 0 1 auto; min-width: 0; padding: 1px 5px; overflow: hidden; border-radius: 999px; color: var(--label-color); background: color-mix(in srgb, var(--label-color) 10%, #fff); font-size: 8px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.wa-chat-row-labels small.assigned { color: #54656F; background: #F0F2F5; }
.wa-account-switcher { padding: 8px 12px 0; }
.wa-account-switcher select { width: 100%; min-height: 34px; padding: 5px 30px 5px 10px; border: 1px solid #E3E8EB; border-radius: 8px; color: #3B4A54; background: #fff; font-size: 12px; font-weight: 650; }
.wa-offline-notice { margin: 8px 10px 4px; padding: 10px 11px; display: flex; align-items: center; gap: 10px; border-radius: 9px; color: #7A4F01; background: #FFF6D8; }
.wa-offline-notice > i { font-size: 18px; }
.wa-offline-notice span { min-width: 0; }
.wa-offline-notice strong, .wa-offline-notice small { display: block; }
.wa-offline-notice small { color: #8A6D2F; font-size: 10px; }
.wa-chat-list { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.wa-chat-row { min-height: 72px; padding: 0 12px; display: flex; align-items: center; gap: 11px; color: #111B21; }
.wa-chat-row:hover, .wa-chat-row.active { color: #111B21; background: #F0F2F5; }
.wa-avatar { position: relative; width: 48px; height: 48px; flex: 0 0 48px; display: grid; place-items: center; overflow: hidden; border-radius: 50%; color: #fff; background: #7C8FA0; font-weight: 760; letter-spacing: -.03em; }
.wa-avatar > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: inherit; }
.wa-avatar-0 { background: #547FA5; } .wa-avatar-1 { background: #8C6EAA; } .wa-avatar-2 { background: #D07B61; } .wa-avatar-3 { background: #4E9D88; } .wa-avatar-4 { background: #B28B4A; } .wa-avatar-5 { background: #6877B1; }
.wa-chat-row-body { align-self: stretch; min-width: 0; flex: 1; padding: 13px 0 11px; display: flex; flex-direction: column; justify-content: center; border-bottom: 1px solid #EEF1F3; }
.wa-chat-row-top, .wa-chat-row-bottom { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.wa-chat-row-top strong { font-size: 14px; font-weight: 650; }
.wa-chat-row-top time { flex: 0 0 auto; color: #667781; font-size: 10px; }
.wa-chat-preview { min-width: 0; flex: 1; color: #667781; font-size: 12px; }
.wa-chat-preview .message-status-icon { margin-right: 3px; }
.wa-chat-flags { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; color: #8696A0; font-size: 11px; }
.wa-unread { min-width: 19px; height: 19px; padding: 0 5px; display: inline-grid; place-items: center; border-radius: 999px; background: #25D366; color: #fff; font-size: 10px; font-weight: 800; }
.wa-inbox-empty { padding: 58px 28px; display: grid; place-items: center; text-align: center; color: #667781; }
.wa-inbox-empty > i { margin-bottom: 15px; color: #B3BFC5; font-size: 42px; }
.wa-inbox-empty strong { color: #3B4A54; }
.wa-inbox-empty span { max-width: 230px; margin-top: 6px; font-size: 12px; line-height: 1.5; }

.wa-conversation-panel { display: flex; flex-direction: column; background: #EFEAE2; }
.wa-conversation-header { position: relative; z-index: 5; }
.wa-contact-heading { min-width: 0; flex: 1; padding: 0; display: flex; align-items: center; gap: 11px; border: 0; background: transparent; color: #111B21; text-align: left; }
.wa-contact-heading .wa-avatar { width: 42px; height: 42px; flex-basis: 42px; }
.wa-contact-heading strong, .wa-contact-heading small { display: block; }
.wa-contact-heading strong { font-size: 14px; font-weight: 670; }
.wa-contact-heading small { color: #667781; font-size: 11px; }
.wa-contact-heading small.typing { color: #00A884; font-weight: 650; }
.wa-mobile-back { display: none; }
.wa-message-search { height: 55px; padding: 7px 11px 7px 18px; display: flex; align-items: center; gap: 9px; background: #fff; border-bottom: 1px solid #E4E9ED; }
.wa-message-search input { min-width: 0; flex: 1; height: 38px; padding: 0 12px; border: 0; outline: 0; border-radius: 8px; background: #F0F2F5; font-size: 13px; }
.wa-message-search > i, .wa-message-search > span { color: #667781; font-size: 12px; }
.wa-message-thread { flex: 1; min-height: 0; padding: 18px clamp(18px, 6vw, 74px) 24px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; overflow-anchor: none; scroll-behavior: smooth; background-color: #EFEAE2; background-image: linear-gradient(rgba(239,234,226,.91), rgba(239,234,226,.91)), radial-gradient(circle at 1px 1px, #8A8176 1px, transparent 0); background-size: auto, 24px 24px; scrollbar-width: thin; }
.wa-load-earlier { align-self: center; margin: 4px 0 10px; padding: 7px 13px; border: 0; border-radius: 999px; color: #54656F; background: rgba(255,255,255,.92); box-shadow: 0 1px 2px rgba(11,20,26,.13); font-size: 11px; }
.wa-date-separator { align-self: stretch; margin: 7px 0; display: flex; justify-content: center; }
.wa-date-separator span { padding: 6px 11px; border-radius: 7px; background: #FFF; color: #54656F; box-shadow: 0 1px 1px rgba(11,20,26,.13); font-size: 10px; text-transform: uppercase; letter-spacing: .02em; }
.wa-thread-empty { margin: auto; padding: 12px 16px; display: flex; align-items: center; gap: 8px; border-radius: 8px; background: #FFEFC6; color: #54656F; font-size: 11px; text-align: center; }
.wa-message { position: relative; align-self: flex-start; max-width: min(72%, 660px); min-width: 84px; padding: 7px 8px 5px; border-radius: 3px 8px 8px 8px; background: #fff; color: #111B21; box-shadow: 0 1px 1px rgba(11,20,26,.15); overflow: visible; overflow-wrap: anywhere; }
.wa-message.outbound { align-self: flex-end; border-radius: 8px 3px 8px 8px; background: #D9FDD3; }
.wa-message.highlighted { animation: wa-highlight 1.7s ease; }
@keyframes wa-highlight { 0%,100% { box-shadow: 0 1px 1px rgba(11,20,26,.15); } 35% { box-shadow: 0 0 0 5px rgba(0,168,132,.3); } }
.wa-message-menu { position: absolute; top: 3px; right: 3px; z-index: 3; opacity: 0; transition: opacity .12s; }
.wa-message.inbound .wa-message-menu { right: 3px; }
.wa-message:hover .wa-message-menu, .wa-message-menu.show { opacity: 1; }
.wa-message-menu > button { width: 27px; height: 24px; display: grid; place-items: center; border: 0; border-radius: 5px; color: #667781; background: linear-gradient(90deg, transparent, inherit); font-size: 11px; }
.wa-message:hover .wa-message-text { padding-right: 18px; }
.wa-reaction-picker { position: absolute; z-index: 20; top: -45px; left: 4px; padding: 5px; display: flex; gap: 1px; border-radius: 999px; background: #fff; box-shadow: 0 5px 25px rgba(11,20,26,.22); white-space: nowrap; }
.wa-message.outbound .wa-reaction-picker { left: auto; right: 4px; }
.wa-reaction-picker[hidden] { display: none; }
.wa-reaction-picker button { width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: transparent; font-size: 18px; }
.wa-reaction-picker button:hover { background: #F0F2F5; transform: scale(1.15); }
.wa-quoted-message { width: 100%; margin-bottom: 5px; padding: 6px 9px; display: block; overflow: hidden; border: 0; border-left: 4px solid #06CF9C; border-radius: 5px; background: rgba(0,0,0,.055); text-align: left; }
.wa-quoted-message strong, .wa-quoted-message span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-quoted-message strong { color: #008069; font-size: 11px; }
.wa-quoted-message span { color: #54656F; font-size: 11px; }
.wa-message-text { padding: 1px 2px; white-space: pre-wrap; line-height: 1.45; }
.wa-group-sender { padding: 0 2px 3px; color: #008069; font-size: 11px; font-weight: 700; }
.wa-message-media { margin: -3px -4px 4px; min-width: 0; overflow: hidden; border-radius: 6px; }
.wa-message-media img, .wa-message-media video { display: block; width: auto; max-width: 100%; max-height: 410px; object-fit: contain; border-radius: 6px; background: #D8DCDE; }
.wa-audio-message { min-width: 280px; padding: 8px 7px; display: flex; align-items: center; gap: 8px; }
.wa-audio-message > i { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: #00A884; }
.wa-audio-message audio { width: min(310px, calc(100vw - 190px)); height: 36px; }
.wa-document-message { min-width: min(330px, calc(100vw - 180px)); max-width: 100%; padding: 9px 10px; display: flex; align-items: center; gap: 10px; border-radius: 6px; color: #111B21; background: rgba(0,0,0,.055); }
.wa-document-message:hover { color: #111B21; background: rgba(0,0,0,.08); }
.wa-document-message > i:first-child { font-size: 28px; color: #70818A; }
.wa-document-message span { min-width: 0; flex: 1; }
.wa-document-message strong, .wa-document-message small { display: block; }
.wa-document-message small { color: #667781; font-size: 10px; }
.wa-missing-media, .wa-deleted-copy { padding: 4px 3px; color: #667781; font-size: 12px; font-style: italic; }
.wa-message.deleted { background: #FFF; }
.wa-message.outbound.deleted { background: #D9FDD3; }
.wa-message-meta { min-height: 13px; margin: 2px 0 -1px 12px; display: flex; align-items: center; justify-content: flex-end; gap: 4px; color: #667781; font-size: 9px; white-space: nowrap; }
.wa-message-meta .bi-star-fill { color: #8696A0; }
.wa-message-reactions { position: absolute; left: 7px; bottom: -15px; z-index: 2; display: flex; gap: 3px; }
.wa-message.outbound .wa-message-reactions { left: auto; right: 7px; }
.wa-message-reactions span { padding: 2px 7px; border: 1px solid #E4E9ED; border-radius: 999px; background: #fff; box-shadow: 0 1px 2px rgba(11,20,26,.13); font-size: 12px; }
.message-status-icon { display: inline-flex; align-items: center; justify-content: center; font-size: 12px; vertical-align: middle; }
.message-status-icon.pending { color: #64748B; }
.message-status-icon.sent, .message-status-icon.delivered { color: #64748B; }
.message-status-icon.read { color: #0EA5E9; }
.message-status-icon.failed { color: #DC2626; }
.wa-composer-wrap { position: relative; z-index: 6; background: #F0F2F5; border-top: 1px solid #DFE5E8; }
.wa-composer { min-height: 62px; padding: 8px 11px; display: flex; align-items: flex-end; gap: 3px; }
.wa-composer textarea { min-width: 0; min-height: 42px; max-height: 126px; flex: 1; padding: 11px 14px; resize: none; border: 0; outline: 0; border-radius: 9px; color: #111B21; background: #fff; line-height: 20px; scrollbar-width: thin; }
.wa-composer .wa-icon-btn { flex: 0 0 40px; margin-bottom: 1px; }
.wa-send-btn { width: 42px; height: 42px; min-height: 0; flex: 0 0 42px; margin-bottom: 1px; display: grid; place-items: center; border: 0; border-radius: 50%; color: #fff; background: #00A884; font-size: 16px; }
.wa-send-btn:hover { background: #008F72; }
.wa-send-btn:disabled { opacity: .4; }
.wa-attach-menu { width: 210px; padding: 7px; }
.wa-attach-menu .dropdown-item { padding: 9px; display: flex; align-items: center; gap: 11px; border-radius: 7px; }
.wa-attach-menu i { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #F0F2F5; font-size: 17px; }
.wa-reply-strip, .wa-attachment-preview { min-height: 58px; margin: 8px 12px 0; padding: 7px 9px; display: flex; align-items: center; gap: 9px; border-radius: 8px; background: #fff; border-left: 4px solid #00A884; box-shadow: 0 1px 2px rgba(11,20,26,.08); }
.wa-reply-strip[hidden], .wa-attachment-preview[hidden] { display: none; }
.wa-reply-strip > div { min-width: 0; flex: 1; display: flex; align-items: center; gap: 10px; }
.wa-reply-strip > div > i { color: #00A884; font-size: 20px; }
.wa-reply-strip strong, .wa-reply-strip small { display: block; }
.wa-reply-strip strong { color: #008069; font-size: 11px; }
.wa-reply-strip small { max-width: 55vw; overflow: hidden; color: #667781; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.wa-attachment-preview > div { width: 46px; height: 46px; flex: 0 0 46px; display: grid; place-items: center; overflow: hidden; border-radius: 6px; color: #fff; background: #667781; font-size: 20px; }
.wa-attachment-preview img, .wa-attachment-preview video { width: 100%; height: 100%; object-fit: cover; }
.wa-attachment-preview > span { min-width: 0; flex: 1; }
.wa-attachment-preview strong, .wa-attachment-preview small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-attachment-preview small { color: #667781; font-size: 10px; }
.wa-emoji-panel { position: absolute; left: 12px; bottom: 64px; width: min(360px, calc(100vw - 50px)); padding: 10px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; border-radius: 12px; background: #fff; box-shadow: 0 7px 30px rgba(11,20,26,.2); }
.wa-emoji-panel[hidden] { display: none; }
.wa-emoji-panel button { height: 39px; border: 0; border-radius: 7px; background: transparent; font-size: 20px; }
.wa-emoji-panel button:hover { background: #F0F2F5; }
.wa-recording-status { position: absolute; inset: auto 0 0; min-height: 62px; padding: 9px 16px; display: flex; align-items: center; gap: 12px; background: #F0F2F5; }
.wa-recording-status[hidden] { display: none; }
.wa-recording-status span { min-width: 0; flex: 1; color: #54656F; }
.wa-recording-status span i { color: #E74C3C; }
.wa-recording-status button { padding: 7px 11px; border: 0; border-radius: 7px; color: #008069; background: #fff; font-weight: 650; }
.wa-read-only { min-height: 54px; display: grid; place-items: center; color: #667781; background: #F0F2F5; }
.wa-chat-welcome { height: 100%; padding: 35px; display: grid; place-items: center; align-content: center; text-align: center; color: #667781; background: #F7F9FA; border-bottom: 6px solid #25D366; }
.wa-welcome-art { width: 145px; height: 145px; margin-bottom: 22px; display: grid; place-items: center; border-radius: 50%; color: #00A884; background: #E2F5EF; font-size: 58px; }
.wa-chat-welcome h3 { color: #3B4A54; font-size: 25px; font-weight: 400; }
.wa-chat-welcome p { max-width: 510px; line-height: 1.65; }
.wa-chat-welcome > div:last-child { margin-top: 30px; font-size: 11px; }
.wa-disconnected-state { gap: 10px; background: linear-gradient(180deg, #F7F9FA 0%, #EFF7F5 100%); }
.wa-disconnected-state .wa-connection-error { max-width: 560px; margin: 4px 0 12px; padding: 10px 13px; display: flex; align-items: flex-start; gap: 9px; border-radius: 10px; color: #8A3B2F; background: #FDEBE8; text-align: left; font-size: 12px; }

.wa-details-panel { width: 100%; overflow: hidden; display: flex; flex-direction: column; background: #F0F2F5; border-left: 1px solid #DDE3E8; }
.wa-details-header { gap: 10px; white-space: nowrap; }
.wa-details-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.wa-contact-card { padding: 28px 20px 24px; text-align: center; background: #fff; }
.wa-avatar-xl { width: 96px; height: 96px; margin: 0 auto 16px; font-size: 30px; }
.wa-label-choice input { position: absolute; opacity: 0; pointer-events: none; }
.wa-label-choice span { display: inline-flex; padding: 4px 8px; border: 1px solid color-mix(in srgb, var(--label-color) 45%, #fff); border-radius: 999px; color: var(--label-color); background: color-mix(in srgb, var(--label-color) 9%, #fff); font-size: 10px; font-weight: 700; cursor: pointer; }
.wa-label-choice input:checked + span { color: #fff; background: var(--label-color); }
.wa-crm-note { margin-bottom: 8px; padding: 8px 10px; border-radius: 8px; background: #F5F7F8; }
.wa-crm-note strong, .wa-crm-note span, .wa-crm-note small { display: block; }
.wa-crm-note strong { font-size: 10px; color: #008069; }
.wa-crm-note span { margin: 2px 0; font-size: 11px; white-space: pre-wrap; }
.wa-crm-note small { color: #8696A0; font-size: 9px; }
.wa-crm-item { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px solid #F0F2F5; }
.wa-crm-item > i { color: #00A884; font-size: 17px; }
.wa-crm-item span, .wa-crm-item strong, .wa-crm-item small { display: block; min-width: 0; }
.wa-crm-item strong { font-size: 11px; }
.wa-crm-item small { color: #667781; font-size: 9px; }
.wa-forwarded-label { margin-bottom: 2px; color: #667781; font-size: 10px; font-style: italic; }
.wa-contact-card h3 { margin: 0; font-size: 19px; font-weight: 500; }
.wa-contact-card p { margin: 5px 0 0; color: #667781; }
.wa-details-section { margin-top: 8px; padding: 16px 18px; background: #fff; }
.wa-details-title { display: flex; justify-content: space-between; color: #008069; font-size: 12px; }
.wa-details-title strong { color: #667781; font-weight: 500; }
.wa-media-grid { margin-top: 12px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.wa-media-grid a { aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; color: #667781; background: #E9EDEF; font-size: 22px; }
.wa-media-grid img { width: 100%; height: 100%; object-fit: cover; }
.wa-details-empty { margin: 13px 0 0; color: #8696A0; font-size: 11px; }
.wa-details-options { padding: 5px 0; }
.wa-details-options button { width: 100%; padding: 13px 18px; display: flex; align-items: center; gap: 14px; border: 0; color: #111B21; background: #fff; text-align: left; }
.wa-details-options button:hover { background: #F5F6F6; }
.wa-details-options button > i { width: 24px; color: #54656F; font-size: 18px; text-align: center; }
.wa-details-options strong, .wa-details-options small { display: block; }
.wa-details-options strong { font-size: 13px; font-weight: 500; }
.wa-details-options small { color: #8696A0; font-size: 10px; }
.wa-security-note { display: flex; gap: 10px; color: #667781; font-size: 11px; line-height: 1.5; }
.wa-security-note > i { color: #00A884; }
.wa-details-scrim { display: none; }
.upload-zone { border: 2px dashed #BDD4F8; border-radius: 16px; background: #F8FBFF; padding: 42px 20px; text-align: center; transition: .2s; }
.upload-zone.dragover { border-color: var(--brand); background: var(--brand-soft); }
.upload-zone i { color: var(--brand); font-size: 35px; }
.filter-bar { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 18px; }
.check-list { max-height: 330px; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; padding: 6px; }
.check-list .form-check { padding: 10px 10px 10px 35px; margin: 0; border-bottom: 1px solid #F1F5F9; }
.check-list .form-check:last-child { border-bottom: 0; }
.chart-wrap { min-height: 300px; position: relative; }
.about-hero { background: #111827; color: #fff; border-radius: 20px; padding: 44px; position: relative; overflow: hidden; }
.about-hero::after { content: ''; position: absolute; width: 250px; height: 250px; right: -80px; top: -100px; background: rgba(63,135,252,.18); border-radius: 50%; }
.about-hero .brand-mark { margin-bottom: 22px; }
.about-hero p { color: #CBD5E1; max-width: 690px; font-size: 15px; line-height: 1.75; }

.auth-page { min-height: 100vh; background: #EEF4FD; display: grid; place-items: center; padding: 24px; }
.auth-shell { width: 100%; max-width: 1040px; display: grid; grid-template-columns: 1.05fr .95fr; border-radius: 24px; overflow: hidden; background: #fff; box-shadow: 0 24px 80px rgba(15,23,42,.13); }
.auth-brand { background: #111827; color: #fff; padding: 58px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-brand::after { content: ''; width: 330px; height: 330px; background: rgba(63,135,252,.17); position: absolute; right: -120px; bottom: -150px; border-radius: 50%; }
.auth-brand h1 { font-size: 36px; font-weight: 800; letter-spacing: -.04em; margin: 36px 0 15px; }
.auth-brand p { color: #CBD5E1; line-height: 1.7; max-width: 400px; }
.auth-form { padding: 58px; align-self: center; }
.auth-form h2 { font-size: 27px; font-weight: 800; letter-spacing: -.03em; }
.credit { color: #94A3B8; font-size: 11px; position: relative; z-index: 1; }
.install-shell { width: min(1080px, 100%); background: #fff; border-radius: 24px; box-shadow: 0 24px 80px rgba(15,23,42,.12); overflow: hidden; }
.install-header { background: #111827; color: #fff; padding: 26px 34px; display: flex; align-items: center; gap: 14px; }
.install-body { padding: 34px; }
.requirement-row { display: flex; justify-content: space-between; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--border); }

@media (max-width: 1450px) {
  .wa-web-shell, .wa-web-shell.details-open { grid-template-columns: minmax(300px, 340px) minmax(420px, 1fr); }
  .wa-details-panel { width: min(360px, 90%); position: absolute; z-index: 31; inset: 0 0 0 auto; transform: translateX(102%); transition: transform .2s ease; box-shadow: -8px 0 28px rgba(11,20,26,.16); }
  .wa-web-shell.details-open .wa-details-panel { transform: translateX(0); }
  .wa-details-scrim { position: absolute; z-index: 30; inset: 0; border: 0; background: rgba(11,20,26,.28); }
  .wa-web-shell.details-open .wa-details-scrim { display: block; }
}

@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); }
  body.sidebar-open .app-sidebar { transform: translateX(0); }
  body.sidebar-open::after { content: ''; position: fixed; inset: 0; background: rgba(15,23,42,.48); z-index: 1030; }
  .app-main { margin-left: 0; }
  .mobile-menu { display: grid; }
  .auth-shell { grid-template-columns: 1fr; max-width: 600px; }
  .auth-brand { padding: 32px; min-height: 260px; }
  .auth-brand h1 { font-size: 29px; margin-top: 24px; }
  .wizard-steps { grid-template-columns: repeat(5, minmax(58px, 1fr)); overflow-x: auto; }
  .content-wrap:has(.wa-web-shell) { padding: 12px; }
  .wa-web-shell, .wa-web-shell.details-open { height: calc(100vh - 100px); grid-template-columns: minmax(290px, 330px) minmax(400px, 1fr); }
}

@media (max-width: 767.98px) {
  .app-topbar { height: 66px; padding: 0 16px; }
  .content-wrap { padding: 20px 16px 30px; }
  .content-wrap:has(.wa-web-shell) { padding: 0; }
  .page-heading { font-size: 17px; }
  .wa-pill .wa-label { display: none; }
  .topbar-actions { gap: 7px; }
  .page-intro { flex-direction: column; }
  .page-intro .d-flex { width: 100%; flex-wrap: wrap; }
  .page-intro .btn { flex: 1; }
  .card-body, .card-header { padding: 17px; }
  .auth-page { padding: 0; display: block; background: #fff; }
  .auth-shell, .install-shell { min-height: 100vh; border-radius: 0; box-shadow: none; }
  .auth-brand { min-height: 230px; }
  .auth-form { padding: 34px 25px; }
  .install-header, .install-body { padding: 24px 20px; }
  .qr-frame { min-height: 280px; width: 300px; }
  .about-hero { padding: 30px 24px; }
  .filter-bar .row > div { margin-bottom: 8px; }
  .table-responsive { font-size: 13px; }
  .wizard-step-label { min-width: 66px; }
  .wizard-step-label small { display: none; }
  .wa-web-shell, .wa-web-shell.details-open { height: calc(100vh - 66px); min-height: 520px; display: block; border: 0; border-radius: 0; box-shadow: none; }
  .wa-inbox-panel { height: 100%; border-right: 0; }
  .wa-conversation-panel { height: 100%; display: none; }
  .wa-web-shell.has-selected-chat .wa-inbox-panel { display: none; }
  .wa-web-shell.has-selected-chat .wa-conversation-panel { display: flex; }
  .wa-mobile-back { display: grid; flex: 0 0 40px; }
  .wa-message-thread { padding: 14px 12px 20px; }
  .wa-message { max-width: 88%; }
  .wa-conversation-header { padding-inline: 5px 8px; }
  .wa-details-panel { position: absolute; width: min(360px, 94%); }
  .wa-emoji-panel { left: 5px; }
  .wa-composer { padding-inline: 4px; }
  .wa-composer .wa-icon-btn { flex-basis: 36px; width: 36px; }
  .wa-document-message { min-width: min(270px, calc(100vw - 90px)); }
}
