:root {
    --brand: #25d366;
    --brand-hover: #1ebe57;
    --brand-soft: #e8f8ee;
    --ink: #1f2937;
    --muted: #6b7280;
    --surface: #f8f9fa;
    --card: #ffffff;
    --border: #e5e7eb;
    --radius: 1rem;
    --shadow-soft: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
    --shadow-card: 0 4px 16px -4px rgba(16, 24, 40, 0.06), 0 2px 6px -2px rgba(16, 24, 40, 0.04);
    --shadow-lifted: 0 12px 32px -12px rgba(16, 24, 40, 0.12);
    --sidebar-width: 16rem;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: "Inter", system-ui, -apple-system, sans-serif;
    color: var(--ink);
    background: var(--surface);
    margin: 0;
    overflow-x: hidden;
}

img,
svg,
video {
    max-width: 100%;
    height: auto;
}

.table-responsive {
    -webkit-overflow-scrolling: touch;
}

.auth-body {
    background: #fff;
}

.text-brand,
.link-brand {
    color: var(--brand) !important;
}

.link-brand:hover {
    color: var(--brand-hover) !important;
}

.btn-brand {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.btn-brand:hover,
.btn-brand:focus {
    background: var(--brand-hover);
    border-color: var(--brand-hover);
    color: #fff;
}

.rounded-xl {
    border-radius: 12px !important;
}

.rounded-2xl {
    border-radius: 16px !important;
}

.rounded-3xl {
    border-radius: 24px !important;
}

.rounded-top-2xl {
    border-top-left-radius: 16px !important;
    border-top-right-radius: 16px !important;
}

.shadow-soft {
    box-shadow: var(--shadow-soft);
}

.shadow-card {
    box-shadow: var(--shadow-card);
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 16px;
    background: var(--brand);
    color: #fff;
    display: grid;
    place-items: center;
    box-shadow: var(--shadow-soft);
}

.brand-icon-sm {
    width: 36px;
    height: 36px;
    border-radius: 12px;
}

.brand-icon-lg {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    font-size: 2rem;
    box-shadow: var(--shadow-lifted);
}

@media (min-width: 576px) {
    .brand-icon-lg {
        width: 96px;
        height: 96px;
        border-radius: 24px;
        font-size: 2.5rem;
    }
}

.form-control:focus,
.form-check-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 0.2rem rgba(37, 211, 102, 0.2);
}

.form-check-input:checked {
    background-color: var(--brand);
    border-color: var(--brand);
}

.login-grid {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
}

@media (min-width: 992px) {
    .login-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.login-form-pane {
    min-width: 0;
    width: 100%;
}

.login-hero-pane {
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.15), transparent 45%, rgba(37, 211, 102, 0.1));
    background-color: var(--brand-soft);
}

.auth-card {
    max-width: 460px;
    width: 100%;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
}

@media (min-width: 576px) {
    .auth-card {
        padding: 2rem;
    }
}

/* User shell */
.app-body {
    overflow-x: hidden;
}

.user-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    background: #fff;
    border-right: 1px solid var(--border);
    z-index: 30;
}

.sidebar-brand {
    height: 64px;
}

.sidebar-link {
    color: var(--muted) !important;
    border-radius: 12px;
    padding: 0.7rem 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.925rem;
    font-weight: 500;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: var(--brand-soft);
    color: var(--brand-hover) !important;
}

.user-content {
    min-height: 100vh;
    min-width: 0;
    width: 100%;
}

@media (min-width: 992px) {
    .user-content {
        margin-left: var(--sidebar-width);
        width: calc(100% - var(--sidebar-width));
    }
}

.user-header {
    min-height: 56px;
    height: auto;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
    background: rgba(248, 249, 250, 0.9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    z-index: 20;
}

@media (min-width: 576px) {
    .user-header {
        min-height: 64px;
    }
}

.user-offcanvas {
    width: min(20rem, 88vw) !important;
}

.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: rgba(37, 211, 102, 0.15);
    color: var(--brand-hover);
    display: grid;
    place-items: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.user-main {
    padding-top: 1rem;
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
    min-width: 0;
}

@media (min-width: 576px) {
    .user-main {
        padding-top: 1.5rem;
    }
}

@media (min-width: 992px) {
    .user-main {
        padding-bottom: 2.5rem;
    }
}

.mobile-bottom-nav {
    position: fixed;
    inset: auto 0 0 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--border);
    z-index: 30;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.55rem 0.15rem;
    font-size: 10px;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    min-width: 0;
}

.mobile-nav-link i {
    font-size: 1.15rem;
}

.mobile-nav-link span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (min-width: 400px) {
    .mobile-nav-link {
        font-size: 11px;
        padding: 0.65rem 0.25rem;
        gap: 0.2rem;
    }
}

.mobile-nav-link.active,
.mobile-nav-link:hover {
    color: var(--brand);
}

.mobile-fab {
    position: fixed;
    right: max(1rem, env(safe-area-inset-right, 0px));
    bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
    width: 56px;
    height: 56px;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    display: grid;
    place-items: center;
    box-shadow: var(--shadow-lifted);
    z-index: 30;
    text-decoration: none;
}

.mobile-fab:hover {
    background: var(--brand-hover);
    color: #fff;
}

.dashboard-stack {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.welcome-banner {
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.12), #fff 55%);
    border: 1px solid var(--border);
}

.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.25rem;
    height: 100%;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    margin-bottom: 1rem;
}

.stat-icon.tone-primary { background: rgba(37, 211, 102, 0.12); color: var(--brand-hover); }
.stat-icon.tone-sky { background: #e0f2fe; color: #0284c7; }
.stat-icon.tone-amber { background: #fef3c7; color: #d97706; }
.stat-icon.tone-violet { background: #ede9fe; color: #7c3aed; }

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

@media (min-width: 576px) {
    .stat-value {
        font-size: 1.875rem;
    }
}

.stat-label {
    margin-top: 0.25rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.activity-avatar {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: rgba(37, 211, 102, 0.12);
    color: var(--brand-hover);
    display: grid;
    place-items: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.badge-soft-success {
    background: rgba(37, 211, 102, 0.12);
    color: var(--brand-hover);
}

.badge-soft-warning {
    background: #fef3c7;
    color: #b45309;
}

.wa-status-box {
    background: rgba(248, 249, 250, 0.9);
    border: 1px solid var(--border);
}

.settings-tabs .nav-link {
    color: var(--muted);
    background: #fff;
    border: 1px solid var(--border);
    padding: 0.55rem 1rem;
}

.settings-tabs .nav-link.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.btn-facebook {
    background: #1877f2;
    border-color: #1877f2;
    color: #fff;
}

.btn-facebook:hover,
.btn-facebook:focus {
    background: #1666d3;
    border-color: #1666d3;
    color: #fff;
}

.chatbot-layout {
    display: grid;
    gap: 1.5rem;
}

@media (min-width: 1200px) {
    .chatbot-layout {
        grid-template-columns: 1fr 360px;
        align-items: start;
    }

    .chatbot-preview {
        position: sticky;
        top: 5.5rem;
    }
}

.step-number {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: var(--brand-soft);
    color: var(--brand-hover);
    display: grid;
    place-items: center;
    font-weight: 700;
    flex-shrink: 0;
}

.step-card-inactive {
    opacity: 0.65;
    background: #fafafa;
}

.preview-panel {
    background: linear-gradient(180deg, rgba(37, 211, 102, 0.08), #fff 40%);
}

.phone-mockup {
    width: min(280px, 100%);
    border: 8px solid #111827;
    border-radius: 28px;
    background: #111827;
    box-shadow: var(--shadow-lifted);
    overflow: hidden;
}

.phone-notch {
    width: 96px;
    height: 10px;
    margin: 8px auto 0;
    border-radius: 999px;
    background: #374151;
}

.phone-screen {
    margin: 8px;
    border-radius: 20px;
    background: #efeae2;
    min-height: 420px;
    overflow: hidden;
}

.phone-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem;
    background: #075e54;
    color: #fff;
}

.phone-avatar {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    display: grid;
    place-items: center;
    font-size: 0.7rem;
    font-weight: 700;
}

.phone-chat {
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.bubble {
    max-width: 85%;
    padding: 0.55rem 0.7rem;
    border-radius: 12px;
    font-size: 0.8rem;
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
}

.bubble-in {
    align-self: flex-start;
    background: #fff;
    border-top-left-radius: 4px;
}

.bubble-out {
    align-self: flex-end;
    background: #dcf8c6;
    border-top-right-radius: 4px;
}

.chat-meta {
    font-size: 10px;
    color: #6b7280;
}

.rounded-start-xl {
    border-top-left-radius: 12px !important;
    border-bottom-left-radius: 12px !important;
}

.rounded-end-xl {
    border-top-right-radius: 12px !important;
    border-bottom-right-radius: 12px !important;
}

.inbox-shell {
    min-height: calc(100vh - 11.5rem - env(safe-area-inset-bottom, 0px));
    min-height: calc(100dvh - 11.5rem - env(safe-area-inset-bottom, 0px));
}

@media (min-width: 992px) {
    .inbox-shell {
        min-height: calc(100vh - 10rem);
        min-height: calc(100dvh - 10rem);
    }
}

.inbox-grid {
    display: grid;
    min-height: inherit;
}

@media (min-width: 768px) {
    .inbox-grid {
        grid-template-columns: minmax(260px, 320px) 1fr;
    }
}

.inbox-list {
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #fff;
}

.inbox-grid.has-selection .inbox-list {
    display: none;
}

@media (min-width: 768px) {
    .inbox-grid.has-selection .inbox-list {
        display: flex;
    }
}

.inbox-thread-list {
    overflow-y: auto;
    flex: 1;
}

.inbox-thread {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    width: 100%;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
}

.inbox-thread:hover {
    background: rgba(248, 249, 250, 0.9);
}

.inbox-thread.active {
    background: rgba(37, 211, 102, 0.08);
}

.inbox-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #efeae2;
}

.inbox-grid:not(.has-selection) .inbox-panel {
    display: none;
}

@media (min-width: 768px) {
    .inbox-grid:not(.has-selection) .inbox-panel {
        display: flex;
    }
}

.inbox-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.inbox-bubble {
    max-width: min(90%, 28rem);
    border-radius: 16px;
    padding: 0.55rem 0.75rem;
    font-size: 0.875rem;
    box-shadow: var(--shadow-soft);
    white-space: pre-wrap;
    word-break: break-word;
}

@media (min-width: 576px) {
    .inbox-bubble {
        max-width: 75%;
        font-size: 0.9rem;
    }
}

.inbox-bubble.in {
    align-self: flex-start;
    background: #fff;
    border-top-left-radius: 6px;
}

.inbox-bubble.out {
    align-self: flex-end;
    background: #dcf8c6;
    border-top-right-radius: 6px;
}

.inbox-bubble-meta {
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
    font-size: 10px;
    color: #6b7280;
}

.inbox-chip {
    background: rgba(255, 255, 255, 0.55);
    border-radius: 999px;
    padding: 0.1rem 0.45rem;
    font-weight: 600;
}

.inbox-empty {
    flex: 1;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.inbox-footer {
    background: #fff;
}

.analytics-stack {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.chart-line-wrap {
    height: 200px;
}

@media (min-width: 768px) {
    .chart-line-wrap {
        height: 260px;
    }
}

.chart-line {
    width: 100%;
    height: 160px;
    display: block;
}

@media (min-width: 768px) {
    .chart-line {
        height: 220px;
    }
}

.legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    margin-right: 0.35rem;
}

.rounded-start-pill {
    border-top-left-radius: 999px;
    border-bottom-left-radius: 999px;
}

.rounded-end-pill {
    border-top-right-radius: 999px;
    border-bottom-right-radius: 999px;
}

.heatmap-table {
    border-collapse: separate;
    border-spacing: 4px;
    min-width: 520px;
}

.heatmap-table th {
    font-size: 10px;
    font-weight: 500;
    color: var(--muted);
    text-align: center;
    padding: 0 2px;
}

.heatmap-table th:first-child,
.heatmap-table td:first-child,
.heatmap-table tbody th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    padding-right: 8px;
}

.heatmap-cell {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(37, 211, 102, 0.08);
}

/* Admin console */
.admin-body {
    background: var(--bg, #f6f7f9);
    min-height: 100vh;
    overflow-x: hidden;
}

.admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    background: #fff;
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    z-index: 1030;
}

.admin-brand-icon {
    background: #111827 !important;
    color: #fff !important;
}

.admin-content {
    min-height: 100vh;
    min-width: 0;
    width: 100%;
}

@media (min-width: 992px) {
    .admin-content {
        margin-left: var(--sidebar-width);
        width: calc(100% - var(--sidebar-width));
    }
}

.admin-header {
    min-height: 3.5rem;
    height: auto;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
    background: rgba(246, 247, 249, 0.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

@media (min-width: 576px) {
    .admin-header {
        min-height: 4rem;
    }
}

.avatar-admin {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.admin-offcanvas {
    width: min(20rem, 88vw) !important;
}

.admin-main {
    padding-top: 1rem;
    padding-bottom: 2rem;
}

@media (min-width: 576px) {
    .admin-main {
        padding-top: 1.5rem;
        padding-bottom: 2.5rem;
    }
}

.admin-stack {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

@media (min-width: 576px) {
    .admin-stack {
        gap: 1.5rem;
    }
}

.admin-table thead {
    background: rgba(0, 0, 0, 0.02);
}

.admin-table th {
    font-weight: 500;
    border-bottom-width: 1px;
    white-space: nowrap;
}

.admin-table td {
    vertical-align: middle;
}

.avatar-sm {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 0.75rem;
}

.admin-log-tail {
    max-height: 280px;
    overflow: auto;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 0.75rem;
    padding: 0.85rem;
    font-size: 0.7rem;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
}

@media (min-width: 768px) {
    .admin-log-tail {
        max-height: 320px;
        font-size: 0.75rem;
        white-space: pre;
        word-break: normal;
    }
}

/* Admin WhatsApp accounts */
.wa-accounts-page {
    min-width: 0;
}

.wa-accounts-hero {
    position: relative;
    overflow: hidden;
    padding: 1rem;
    border: 1px solid rgba(37, 211, 102, 0.14);
    background:
        radial-gradient(ellipse 80% 120% at 100% 0%, rgba(37, 211, 102, 0.16), transparent 55%),
        linear-gradient(135deg, #ffffff 0%, #f3fbf6 100%);
    box-shadow: var(--shadow-soft);
}

@media (min-width: 576px) {
    .wa-accounts-hero {
        padding: 1.25rem 1.35rem;
    }
}

.wa-accounts-hero-inner {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 768px) {
    .wa-accounts-hero-inner {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
        gap: 1.25rem;
    }
}

.wa-accounts-hero-copy {
    min-width: 0;
}

.wa-accounts-kicker {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brand);
}

.wa-accounts-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    width: 100%;
}

@media (min-width: 576px) {
    .wa-accounts-stats {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0.6rem;
    }
}

@media (min-width: 768px) {
    .wa-accounts-stats {
        width: auto;
        min-width: 18rem;
        flex-shrink: 0;
    }
}

.wa-stat-chip {
    min-width: 0;
    padding: 0.5rem 0.65rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--border);
    text-align: center;
    backdrop-filter: blur(6px);
}

@media (min-width: 576px) {
    .wa-stat-chip {
        padding: 0.55rem 0.85rem;
    }
}

.wa-stat-chip.is-ok {
    border-color: rgba(37, 211, 102, 0.28);
    background: rgba(37, 211, 102, 0.08);
}

.wa-stat-chip.is-warn {
    border-color: rgba(245, 158, 11, 0.28);
    background: rgba(245, 158, 11, 0.08);
}

.wa-stat-chip.is-off {
    border-color: rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.06);
}

.wa-stat-value {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--ink);
}

@media (min-width: 576px) {
    .wa-stat-value {
        font-size: 1.15rem;
    }
}

.wa-stat-label {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.wa-account-card {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--card);
    box-shadow: var(--shadow-soft);
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

@media (min-width: 768px) {
    .wa-account-card {
        border-radius: 20px;
    }

    .wa-account-card:hover {
        transform: translateY(-3px);
        box-shadow: var(--shadow-lifted);
        border-color: rgba(37, 211, 102, 0.28);
    }
}

.wa-account-card-glow {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #9ca3af, #d1d5db);
}

.wa-account-card.is-connected .wa-account-card-glow {
    background: linear-gradient(90deg, #1ebe57, #25d366, #86efac);
}

.wa-account-card.is-pending .wa-account-card-glow {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.wa-account-card.is-error .wa-account-card-glow,
.wa-account-card.is-disconnected .wa-account-card-glow {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.wa-account-card-body {
    position: relative;
    padding: 1rem;
}

@media (min-width: 576px) {
    .wa-account-card-body {
        padding: 1.25rem 1.25rem 1.15rem;
    }
}

.wa-account-top {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.65rem 0.75rem;
    align-items: start;
}

@media (max-width: 379px) {
    .wa-account-top {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .wa-account-top .wa-status-pill {
        grid-column: 1 / -1;
        justify-self: start;
    }
}

.wa-account-icon {
    position: relative;
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #25d366, #1ebe57);
    color: #fff;
    font-size: 1.1rem;
    box-shadow: 0 8px 18px -8px rgba(37, 211, 102, 0.7);
}

@media (min-width: 576px) {
    .wa-account-icon {
        width: 2.75rem;
        height: 2.75rem;
        border-radius: 14px;
        font-size: 1.2rem;
    }
}

.wa-account-icon.is-muted {
    background: linear-gradient(145deg, #9ca3af, #6b7280);
    box-shadow: none;
}

.wa-live-dot {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #22c55e;
    border: 2px solid #fff;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
    animation: wa-pulse 2s infinite;
}

@keyframes wa-pulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45); }
    70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.wa-account-number {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ink);
}

@media (min-width: 576px) {
    .wa-account-number {
        font-size: 1rem;
    }
}

.wa-account-id {
    margin-top: 0.15rem;
    font-size: 0.68rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: var(--muted);
    overflow-wrap: anywhere;
}

@media (min-width: 576px) {
    .wa-account-id {
        font-size: 0.72rem;
    }
}

.wa-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

@media (min-width: 576px) {
    .wa-status-pill {
        font-size: 0.7rem;
    }
}

.wa-status-pill.is-connected {
    background: rgba(37, 211, 102, 0.12);
    color: #15803d;
}

.wa-status-pill.is-pending {
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
}

.wa-status-pill.is-error,
.wa-status-pill.is-disconnected {
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
}

.wa-status-pulse {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
    animation: wa-blink 1.6s ease-in-out infinite;
}

@keyframes wa-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.wa-account-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
    padding: 0.85rem;
    border-radius: 14px;
    background: linear-gradient(180deg, #f8faf9 0%, #f3f4f6 100%);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

@media (min-width: 420px) {
    .wa-account-meta {
        grid-template-columns: 1.2fr 0.8fr;
        padding: 0.9rem;
    }
}

.wa-meta-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.wa-meta-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink);
    overflow-wrap: anywhere;
}

@media (min-width: 576px) {
    .wa-meta-value {
        font-size: 0.875rem;
    }
}

.wa-meta-sub {
    font-size: 0.7rem;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.wa-owner-avatar {
    background: rgba(37, 211, 102, 0.12) !important;
    color: #15803d !important;
    flex-shrink: 0;
}

.wa-btn-disconnect {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 2.5rem;
    padding: 0.55rem 0.9rem;
    border-radius: 12px !important;
    border: 1px solid rgba(239, 68, 68, 0.22);
    background: rgba(239, 68, 68, 0.04);
    color: #b91c1c;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.wa-btn-disconnect:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
}

.wa-offline-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 2.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 12px;
    background: rgba(107, 114, 128, 0.08);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 500;
    text-align: center;
    line-height: 1.35;
}

.wa-empty-state {
    padding: 2.5rem 1.25rem;
    border: 1px dashed rgba(37, 211, 102, 0.35);
    background:
        radial-gradient(circle at 50% 0%, rgba(37, 211, 102, 0.1), transparent 55%),
        #fff;
}

@media (min-width: 576px) {
    .wa-empty-state {
        padding: 3.5rem 1.5rem;
    }
}

.wa-empty-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 1rem;
    display: grid;
    place-items: center;
    background: var(--brand);
    color: #fff;
    font-size: 1.5rem;
    box-shadow: 0 12px 28px -12px rgba(37, 211, 102, 0.8);
}

@media (prefers-reduced-motion: reduce) {
    .wa-account-card,
    .wa-live-dot,
    .wa-status-pulse {
        animation: none !important;
        transition: none !important;
    }

    .wa-account-card:hover {
        transform: none;
    }
}

/* Global mobile polish (user + admin) */
@media (max-width: 575.98px) {
    .stat-card {
        padding: 1rem;
    }

    .welcome-banner {
        padding: 1.1rem !important;
    }

    .welcome-banner .h3 {
        font-size: 1.25rem;
    }

    .preview-panel {
        padding: 1rem !important;
    }

    .btn.btn-brand.btn-lg,
    .btn.btn-lg {
        width: 100%;
    }

    .heatmap-cell {
        width: 22px;
        height: 22px;
    }

    .heatmap-table {
        min-width: 440px;
    }
}

.admin-main {
    padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
}

.admin-header {
    padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
}

@media (min-width: 576px) {
    .admin-header {
        padding-left: max(1rem, env(safe-area-inset-left, 0px));
        padding-right: max(1rem, env(safe-area-inset-right, 0px));
    }
}

.admin-table td,
.admin-table th {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

@media (min-width: 768px) {
    .admin-table .ps-4 {
        padding-left: 1.5rem !important;
    }

    .admin-table .pe-4 {
        padding-right: 1.5rem !important;
    }
}

.form-control-lg {
    font-size: 1rem;
}

@media (max-width: 575.98px) {
    .form-control-lg {
        font-size: 0.95rem;
        min-height: 2.75rem;
    }
}

.chatbot-layout,
.analytics-stack,
.dashboard-stack {
    min-width: 0;
}

.step-card .btn-sm {
    min-width: 2.25rem;
}
