
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@500;700;800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Core palette — light */
    --forest-900: #0d4430;
    --forest-800: #145939;
    --forest-700: #1c7449;
    --leaf-500: #25d366;
    --leaf-600: #1aa851;
    --leaf-100: #e3f9ec;

    --sidebar-bg-1: #f7fffa;
    --sidebar-bg-2: #e9f9ee;
    --sidebar-line: #d9f0e0;

    --mint-50: #f8fdfa;
    --paper: #ffffff;
    --ink-900: #16281f;
    --slate-600: #62766c;
    --slate-500: #78907f;
    --slate-400: #94aa9f;
    --line: #e6f1ea;
    --line-soft: #f1f8f4;

    --gold-500: #d9a441;
    --gold-100: #fbf1dc;
    --coral-500: #e1543a;
    --coral-100: #fce6e1;
    --sky-500: #34b7f1;
    --sky-100: #e4f6fd;

    --shadow-sm: 0 1px 2px rgba(6, 34, 25, 0.06);
    --shadow-md: 0 12px 30px rgba(6, 34, 25, 0.08);
    --shadow-lg: 0 22px 55px rgba(6, 34, 25, 0.12);

    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --radius-pill: 999px;

    --font-display: "Manrope", "Inter", sans-serif;
    --font-body: "Inter", -apple-system, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

/* ========================================================================== 
   Documentation hub
   ========================================================================== */

.documentation-page {
    max-width: 1380px;
    margin: 0 auto;
}

.documentation-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.7fr);
    gap: 22px;
    align-items: stretch;
    padding: 34px;
    margin-bottom: 22px;
    border: 1px solid rgba(37, 211, 102, 0.18);
    border-radius: 28px;
    background:
        radial-gradient(circle at 90% 0%, rgba(52, 183, 241, 0.18), transparent 30%),
        linear-gradient(135deg, var(--leaf-100) 0%, var(--paper) 74%);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.documentation-hero-copy h2 {
    max-width: 680px;
    margin: 0 0 10px;
    color: var(--forest-900);
    font-size: clamp(28px, 3vw, 42px);
    line-height: 1.08;
}

.documentation-hero-copy p {
    max-width: 680px;
    margin: 0;
    color: var(--slate-600);
    line-height: 1.7;
    font-size: 15px;
}

.documentation-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.documentation-hero-note {
    align-self: end;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--paper);
    box-shadow: var(--shadow-sm);
}

.documentation-note-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin-bottom: 16px;
    border-radius: 13px;
    background: var(--forest-900);
    color: var(--leaf-500);
}

.documentation-note-icon svg {
    width: 21px;
    height: 21px;
}

.documentation-hero-note strong {
    display: block;
    color: var(--forest-900);
    font-size: 15px;
}

.documentation-hero-note p {
    margin: 7px 0 0;
    color: var(--slate-600);
    font-size: 13px;
    line-height: 1.6;
}

.documentation-layout {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.documentation-rail {
    position: sticky;
    top: 22px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--paper);
    box-shadow: var(--shadow-sm);
}

.documentation-search label {
    display: block;
    margin-bottom: 8px;
    color: var(--forest-900);
    font-size: 12px;
    font-weight: 800;
}

.documentation-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--mint-50);
}

.documentation-search-box svg {
    width: 16px;
    flex: 0 0 16px;
    color: var(--slate-500);
}

.documentation-search-box input {
    width: 100%;
    min-width: 0;
    padding: 11px 0;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 12px;
}

.documentation-search small {
    display: block;
    margin-top: 8px;
    color: var(--slate-500);
    font-size: 11px;
}

.documentation-toc {
    display: grid;
    gap: 3px;
    margin-top: 22px;
}

.documentation-toc-label {
    margin: 0 8px 7px;
    color: var(--slate-500);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.documentation-toc a {
    padding: 9px 10px;
    border-left: 2px solid transparent;
    border-radius: 0 9px 9px 0;
    color: var(--slate-600);
    font-size: 12.5px;
    font-weight: 700;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.documentation-toc a:hover,
.documentation-toc a.active {
    border-color: var(--leaf-500);
    background: var(--leaf-100);
    color: var(--forest-900);
}

.documentation-content {
    min-width: 0;
}

.documentation-section {
    scroll-margin-top: 22px;
    margin-bottom: 24px;
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--paper);
    box-shadow: var(--shadow-sm);
    animation: documentation-reveal 0.5s ease both;
}

.documentation-section:nth-child(2) { animation-delay: 0.04s; }
.documentation-section:nth-child(3) { animation-delay: 0.08s; }
.documentation-section:nth-child(4) { animation-delay: 0.12s; }

@keyframes documentation-reveal {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.documentation-section-heading {
    margin-bottom: 18px;
}

.documentation-section-kicker {
    display: block;
    margin-bottom: 7px;
    color: var(--leaf-600);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.documentation-section-heading h3 {
    margin: 0 0 7px;
    color: var(--forest-900);
    font-size: 23px;
}

.documentation-section-heading p {
    max-width: 680px;
    margin: 0;
    color: var(--slate-600);
    font-size: 13.5px;
    line-height: 1.6;
}

.documentation-checklist,
.documentation-table-wrap,
.documentation-status-list {
    display: grid;
    gap: 10px;
}

.documentation-check-item,
.documentation-mini-step {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--mint-50);
}

.documentation-check-item > span,
.documentation-mini-step > span {
    display: grid;
    place-items: center;
    align-self: start;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: var(--leaf-100);
    color: var(--forest-700);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
}

.documentation-check-item strong,
.documentation-mini-step strong {
    display: block;
    margin-bottom: 4px;
    color: var(--forest-900);
    font-size: 14px;
}

.documentation-check-item p,
.documentation-mini-step p {
    margin: 0;
    color: var(--slate-600);
    font-size: 13px;
    line-height: 1.55;
}

.documentation-section a:not(.btn) {
    color: var(--leaf-600);
    font-weight: 700;
}

.documentation-flow {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.documentation-flow-step {
    position: relative;
    min-height: 140px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: linear-gradient(180deg, var(--mint-50), var(--paper));
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.documentation-flow-step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 28px;
    right: -11px;
    width: 11px;
    height: 1px;
    background: var(--line);
}

.documentation-flow-step:hover,
.documentation-flow-step.is-active {
    border-color: var(--leaf-500);
    box-shadow: 0 12px 26px rgba(37, 211, 102, 0.11);
    transform: translateY(-2px);
}

.documentation-flow-step > span {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    margin-bottom: 14px;
    border-radius: 50%;
    background: var(--forest-900);
    color: var(--paper);
    font-size: 11px;
    font-weight: 800;
}

.documentation-flow-step strong,
.documentation-campaign-grid h4 {
    display: block;
    margin-bottom: 5px;
    color: var(--forest-900);
    font-size: 13.5px;
}

.documentation-flow-step p,
.documentation-campaign-grid p {
    margin: 0;
    color: var(--slate-600);
    font-size: 12px;
    line-height: 1.55;
}

.documentation-flow-detail {
    margin-top: 12px;
    padding: 13px 15px;
    border-left: 3px solid var(--leaf-500);
    border-radius: 0 12px 12px 0;
    background: var(--leaf-100);
    color: var(--forest-900);
    font-size: 13px;
    line-height: 1.6;
}

.documentation-card-grid,
.documentation-campaign-grid,
.documentation-admin-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.documentation-card,
.documentation-campaign-grid article,
.documentation-admin-grid a {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--mint-50);
}

.documentation-card-icon {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    margin-bottom: 13px;
    border-radius: 10px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
}

.documentation-card-icon.tone-green { background: var(--leaf-100); color: var(--forest-700); }
.documentation-card-icon.tone-blue { background: var(--sky-100); color: var(--sky-500); }
.documentation-card-icon.tone-amber { background: var(--gold-100); color: var(--gold-500); }

.documentation-card h4,
.documentation-card p {
    margin: 0;
}

.documentation-card h4 {
    margin-bottom: 6px;
    color: var(--forest-900);
    font-size: 14px;
}

.documentation-card p {
    color: var(--slate-600);
    font-size: 12.5px;
    line-height: 1.6;
}

.documentation-callout {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    padding: 13px 15px;
    border-radius: 13px;
    font-size: 12.5px;
    line-height: 1.55;
}

.documentation-callout strong { flex: 0 0 auto; color: var(--forest-900); }
.documentation-callout span { color: var(--slate-600); }
.documentation-callout.info { background: var(--sky-100); border: 1px solid rgba(52, 183, 241, 0.2); }
.documentation-callout.warning { background: var(--gold-100); border: 1px solid rgba(217, 164, 65, 0.25); }

.documentation-campaign-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.documentation-number {
    display: block;
    margin-bottom: 13px;
    color: var(--leaf-600);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
}

.documentation-status-list > div {
    display: grid;
    grid-template-columns: 10px 130px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line-soft);
}

.documentation-status-list > div:last-child { border-bottom: 0; }
.documentation-status-list strong { color: var(--forest-900); font-size: 13px; }
.documentation-status-list p { margin: 0; color: var(--slate-600); font-size: 12.5px; line-height: 1.5; }

.status-dot { width: 9px; height: 9px; border-radius: 50%; }
.status-pending { background: var(--gold-500); }
.status-processing { background: var(--sky-500); }
.status-sent, .status-delivered { background: var(--leaf-500); }
.status-failed { background: var(--coral-500); }

.documentation-faq { display: grid; gap: 8px; }
.documentation-faq details { padding: 0 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--mint-50); }
.documentation-faq summary { padding: 15px 0; color: var(--forest-900); cursor: pointer; font-size: 13.5px; font-weight: 700; list-style: none; }
.documentation-faq summary::-webkit-details-marker { display: none; }
.documentation-faq summary::after { content: "+"; float: right; color: var(--leaf-600); font-size: 18px; font-weight: 500; }
.documentation-faq details[open] summary::after { content: "-"; }
.documentation-faq p { margin: -2px 0 15px; color: var(--slate-600); font-size: 12.5px; line-height: 1.6; }

.documentation-admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.documentation-admin-grid a { display: grid; gap: 4px; transition: border-color 0.2s ease, transform 0.2s ease; }
.documentation-admin-grid a:hover { border-color: var(--leaf-500); transform: translateY(-2px); }
.documentation-admin-grid strong { color: var(--forest-900); font-size: 14px; }
.documentation-admin-grid span { color: var(--slate-600); font-size: 12px; line-height: 1.5; }
.documentation-admin-grid b { margin-top: 5px; color: var(--leaf-600); font-size: 11px; }

.documentation-no-results { padding: 38px; text-align: center; border: 1px dashed var(--line); border-radius: 18px; background: var(--mint-50); }
.documentation-no-results strong { display: block; margin-bottom: 5px; color: var(--forest-900); }
.documentation-no-results p { margin: 0; color: var(--slate-600); font-size: 13px; }

.onboarding-next-step,
.template-doc-shortcut,
.setup-doc-shortcut {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
}

.onboarding-next-step h3,
.template-doc-shortcut h3,
.setup-doc-shortcut h3 { margin: 0 0 6px; color: var(--forest-900); font-size: 17px; }
.onboarding-next-step p,
.template-doc-shortcut p,
.setup-doc-shortcut p { margin: 0; color: var(--slate-600); font-size: 13px; line-height: 1.55; }
.documentation-shortcut h4 { margin: 0 0 6px; color: var(--forest-900); font-size: 15px; }
.documentation-shortcut p { margin: 0 0 10px; color: var(--slate-600); font-size: 12.5px; line-height: 1.55; }
.setup-doc-link { display: block; margin-bottom: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--mint-50); color: var(--leaf-600); font-size: 13px; font-weight: 700; }

@media (max-width: 1100px) {
    .documentation-layout { grid-template-columns: 190px minmax(0, 1fr); gap: 16px; }
    .documentation-flow { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .documentation-flow-step:nth-child(3)::after { display: none; }
}

@media (max-width: 800px) {
    .documentation-hero { grid-template-columns: 1fr; padding: 24px; }
    .documentation-layout { grid-template-columns: 1fr; }
    .documentation-rail { position: static; }
    .documentation-toc { display: flex; gap: 5px; overflow-x: auto; margin-top: 15px; padding-bottom: 2px; }
    .documentation-toc-label { display: none; }
    .documentation-toc a { flex: 0 0 auto; border-left: 0; border-bottom: 2px solid transparent; border-radius: 8px 8px 0 0; }
    .documentation-toc a:hover, .documentation-toc a.active { border-bottom-color: var(--leaf-500); }
    .documentation-section { padding: 20px; }
    .documentation-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .documentation-flow-step:nth-child(2)::after, .documentation-flow-step:nth-child(4)::after { display: none; }
    .documentation-card-grid, .documentation-campaign-grid, .documentation-admin-grid { grid-template-columns: 1fr; }
    .documentation-status-list > div { grid-template-columns: 10px minmax(110px, 0.5fr) minmax(0, 1fr); }
    .documentation-callout { flex-direction: column; gap: 3px; }
    .onboarding-next-step, .template-doc-shortcut, .setup-doc-shortcut { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    .documentation-section { animation: none; }
    .documentation-flow-step { transition: none; }
}

:root[data-theme="dark"] {
    --forest-900: #e7fff2;
    --forest-800: #caf6df;
    --forest-700: #8fe0b5;
    --leaf-500: #25d366;
    --leaf-600: #5cf08f;
    --leaf-100: #123f2b;

    --sidebar-bg-1: #101d21;
    --sidebar-bg-2: #081416;
    --sidebar-line: #21363b;

    --mint-50: #071315;
    --paper: #111f23;
    --ink-900: #e9f3ef;
    --slate-600: #a7bab2;
    --slate-500: #8da29a;
    --slate-400: #6f867d;
    --line: #22383d;
    --line-soft: #16282c;

    --gold-100: #3a2b0d;
    --coral-100: #3b1712;
    --sky-100: #0e3140;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
    --shadow-md: 0 16px 34px rgba(0, 0, 0, 0.32);
    --shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.38);
}

* {
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--mint-50);
    color: var(--ink-900);
    -webkit-font-smoothing: antialiased;
}

:root[data-theme="dark"] body {
    background:
        radial-gradient(circle at 12% -10%, rgba(37, 211, 102, 0.12), transparent 30%),
        linear-gradient(135deg, #071315 0%, #0b171a 100%);
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    letter-spacing: -0.01em;
}

a {
    color: inherit;
    text-decoration: none;
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

:focus-visible {
    outline: 2px solid var(--leaf-500);
    outline-offset: 2px;
}

/* ==========================================================================
   App shell / sidebar
   ========================================================================== */

.app-shell {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

.sidebar {
    width: 244px;
    background: linear-gradient(180deg, var(--sidebar-bg-1) 0%, var(--sidebar-bg-2) 100%);
    color: var(--ink-900);
    padding: 24px 16px;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-right: 1px solid var(--sidebar-line);
    transition: width 0.22s ease, padding 0.22s ease;
}

:root[data-sidebar="collapsed"] .sidebar {
    width: 84px;
    padding: 24px 10px;
}

:root[data-sidebar="collapsed"] .main {
    margin-left: 84px;
    width: calc(100vw - 84px);
    max-width: calc(100vw - 84px);
}

:root[data-sidebar="collapsed"] .brand {
    justify-content: center;
    gap: 0;
}

:root[data-sidebar="collapsed"] .brand > div:not(.brand-icon),
:root[data-sidebar="collapsed"] .sidebar-card,
:root[data-sidebar="collapsed"] .sidebar-footer {
    overflow: hidden;
}

:root[data-sidebar="collapsed"] .brand h1,
:root[data-sidebar="collapsed"] .sidebar-user-copy,
:root[data-sidebar="collapsed"] .sidebar-theme-toggle .theme-toggle-label,
:root[data-sidebar="collapsed"] .sidebar-logout span,
:root[data-sidebar="collapsed"] .developer-mode-banner {
    opacity: 0;
    visibility: hidden;
    width: 0;
    min-width: 0;
    padding: 0;
    margin: 0;
    pointer-events: none;
}



:root[data-sidebar="collapsed"] .sidebar-collapse-open {
    display: none;
}

:root[data-sidebar="collapsed"] .sidebar-collapse-closed {
    display: block;
}

:root[data-sidebar="collapsed"] .nav {
    justify-items: center;
}

:root[data-sidebar="collapsed"] .nav a {
    width: 100%;
    justify-content: center;
    gap: 0;
    font-size: 0;
    padding-left: 10px;
    padding-right: 10px;
}

:root[data-sidebar="collapsed"] .nav-icon {
    margin: 0;
}

:root[data-sidebar="collapsed"] .nav a.active::before {
    left: -10px;
}

:root[data-sidebar="collapsed"] .sidebar-footer {
    justify-items: center;
}

:root[data-sidebar="collapsed"] .sidebar-theme-toggle {
    width: 46px;
    padding-right: 6px;
}

:root[data-sidebar="collapsed"] .sidebar-theme-toggle .theme-toggle-track {
    margin: 0 auto;
}

:root[data-sidebar="collapsed"] .user-sidebar-card {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 10px;
}

:root[data-sidebar="collapsed"] .sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
}

:root[data-sidebar="collapsed"] .sidebar-logout {
    width: 32px;
    justify-self: center;
}

:root[data-sidebar="collapsed"] .sidebar-card strong,
:root[data-sidebar="collapsed"] .sidebar-card p {
    display: none;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 22px;
    padding: 0 4px;
    position: relative;
}

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--leaf-500);
    color: var(--forest-900);
    font-weight: 800;
    font-size: 21px;
    font-family: var(--font-display);
    box-shadow: 0 0 0 4px rgba(37, 211, 102, 0.18);
}

.brand-icon svg {
    width: 26px;
    height: 26px;
}

.brand h1 {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    color: var(--forest-900);
}

.brand p {
    margin: 2px 0 0;
    font-size: 11px;
    color: var(--leaf-600);
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.sidebar-collapse-toggle {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    margin-left: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper);
    color: var(--slate-600);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    position: absolute;
    top: 2px;
    right: -13px;
    z-index: 20;
}

.sidebar-collapse-toggle svg {
    width: 14px;
    height: 14px;
}

.sidebar-collapse-closed {
    display: none;
}

.sidebar-card {
    margin-top: 14px;
    padding: 14px;
    border-radius: var(--radius-md);
    background: var(--paper);
    border: 1px solid var(--sidebar-line);
}

.sidebar-footer {
    display: grid;
    gap: 14px;
    margin-top: auto;
    padding-top: 14px;
}

.user-sidebar-card {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    row-gap: 8px;
    column-gap: 10px;
    align-items: center;
    margin-top: 0;
    margin-bottom: 0;
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--leaf-500), #9df5bd);
    color: #07331d;
    font-weight: 900;
    font-family: var(--font-display);
}

.sidebar-user-copy {
    min-width: 0;
}

.sidebar-user-copy strong,
.sidebar-user-copy p,
.sidebar-user-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user-copy small {
    margin-top: 4px;
    color: var(--slate-500);
    font-size: 11px;
    font-weight: 700;
    text-transform: capitalize;
}

.sidebar-card strong {
    color: var(--forest-900);
    font-size: 14px;
}

.sidebar-card p {
    margin: 6px 0 0;
    color: var(--slate-600);
    font-size: 12.5px;
    line-height: 1.6;
    word-break: break-word;
}

.sidebar-logout {
    width: 32px;
    height: 32px;
    display: inline-grid;
    place-items: center;
    margin-top: 0;
    border-radius: 10px;
    background: var(--coral-100);
    font-size: 12.5px;
    font-weight: 700;
    color: var(--coral-500);
    grid-column: 1 / -1;
    justify-self: center;
    margin-top: 2px;
}

.sidebar-logout:hover {
    background: var(--coral-500);
    color: #fff;
}

.sidebar-logout svg {
    width: 17px;
    height: 17px;
}

.sidebar-logout span {
    display: none;
}

.nav {
    display: grid;
    gap: 3px;
    margin-top: 6px;
    margin-bottom: 14px;
}

.nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    color: var(--slate-600);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    position: relative;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 19px;
    height: 19px;
    flex-shrink: 0;
    opacity: 0.85;
}

.nav-icon svg {
    width: 100%;
    height: 100%;
    color: currentColor;
}

.nav a:hover .nav-icon,
.nav a.active .nav-icon {
    opacity: 1;
}

.nav a:hover {
    background: var(--paper);
    color: var(--forest-900);
}

.nav a.active {
    background: var(--paper);
    color: var(--forest-900);
    box-shadow: var(--shadow-sm);
}

.nav a.active::before {
    content: "";
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 22px;
    border-radius: 0 4px 4px 0;
    background: var(--leaf-500);
}

/* ==========================================================================
   Main / topbar
   ========================================================================== */

.main {
    flex: 1;
    min-width: 0;
    width: calc(100vw - 244px);
    margin-left: 244px;
    padding: 30px 28px 60px;
    max-width: calc(100vw - 244px);
    overflow-x: hidden;
    transition: margin-left 0.22s ease, width 0.22s ease, max-width 0.22s ease;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 26px;
}

.topbar h2 {
    margin: 0;
    font-size: 27px;
    font-weight: 800;
    color: var(--forest-900);
}

.topbar p {
    margin: 6px 0 0;
    color: var(--slate-600);
    font-size: 14.5px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
    min-width: 0;
}

.theme-toggle {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    padding: 5px 10px 5px 6px;
    background: var(--paper);
    color: var(--ink-900);
    cursor: pointer;
    font-weight: 800;
    font-size: 12px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.theme-toggle:hover {
    border-color: var(--leaf-500);
    transform: translateY(-1px);
}

.theme-toggle-track {
    width: 36px;
    height: 20px;
    position: relative;
    border-radius: var(--radius-pill);
    background: #dcebe4;
    box-shadow: inset 0 0 0 1px rgba(13, 68, 48, 0.08);
}

.theme-toggle-thumb {
    position: absolute;
    left: 3px;
    top: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(6, 34, 25, 0.18);
    transition: transform 0.18s ease, background 0.18s ease;
}

.theme-toggle-thumb {
    display: grid;
    place-items: center;
}

.theme-icon {
    width: 10px;
    height: 10px;
    color: #d9a441;
}

.theme-icon-moon {
    display: none;
    color: #dff6eb;
}

.sidebar-theme-toggle {
    width: 118px;
    justify-content: space-between;
    margin: 2px 0 10px;
}

/* Theme control is shown beside Wallet in the topbar. */
.sidebar-theme-toggle {
    display: none;
}

.topbar-theme-toggle {
    width: 118px;
    min-width: 118px;
    justify-content: space-between;
    margin: 0 2px 0 0;
}

:root[data-theme="dark"] .theme-toggle-track {
    background: #075e54;
}

:root[data-theme="dark"] .theme-toggle-thumb {
    transform: translateX(16px);
    background: var(--leaf-500);
}

:root[data-theme="dark"] .theme-icon-sun {
    display: none;
}

:root[data-theme="dark"] .theme-icon-moon {
    display: block;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--ink-900);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    border-color: var(--leaf-500);
    color: var(--leaf-600);
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--leaf-500);
    border-color: var(--leaf-500);
    color: #06331d;
}

.btn-primary:hover {
    background: var(--leaf-600);
    border-color: var(--leaf-600);
    color: #fff;
}

.btn-danger {
    border-color: var(--coral-100);
    background: var(--coral-100);
    color: var(--coral-500);
}

.btn-danger:hover {
    background: var(--coral-500);
    border-color: var(--coral-500);
    color: #fff;
}

.btn-small {
    min-height: 32px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12.5px;
}

.btn-icon,
.inline-svg-icon,
.status-icon-svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.status-icon svg {
    width: 14px;
    height: 14px;
}

.wa-search-icon,
.wa-empty-icon svg,
.wa-composer-plus svg,
.wa-checks-icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.wa-document-preview {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.wa-checks-icon {
    width: 15px;
    height: 15px;
    margin-left: 4px;
    color: var(--sky-500);
    vertical-align: -2px;
}

.wa-avatar-icon {
    width: 22px;
    height: 22px;
}

.link {
    color: var(--leaf-600);
    font-weight: 700;
}

.link:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Toasts
   ========================================================================== */

.toast-wrap {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

.toast {
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    border: 1px solid var(--line);
    background: var(--paper);
    box-shadow: var(--shadow-sm);
}

.toast.success {
    background: var(--leaf-100);
    border-color: #b9edcd;
    color: #0f5c30;
}

.toast.error {
    background: var(--coral-100);
    border-color: #f6c6bc;
    color: #8f2e1c;
}

/* ==========================================================================
   Panels
   ========================================================================== */

.panel {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.panel-header h3 {
    margin: 0;
    font-size: 19px;
    font-weight: 800;
    color: var(--forest-900);
}

.panel-header p {
    margin: 5px 0 0;
    color: var(--slate-600);
    font-size: 13.5px;
}

.danger-panel {
    border-color: #f6c6bc;
    background: #fffaf9;
}

/* ==========================================================================
   Stats
   ========================================================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.stats-grid.small {
    margin-bottom: 24px;
}

.stat-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.stat-card span {
    display: block;
    color: var(--slate-600);
    font-size: 13px;
    font-weight: 600;
}

.stat-card strong {
    display: block;
    margin-top: 10px;
    font-size: 32px;
    font-family: var(--font-display);
    color: var(--forest-800);
}

.stat-card.danger strong {
    color: var(--coral-500);
}

/* ==========================================================================
   Dashboard (modern analytics view)
   ========================================================================== */

.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(290px, 0.85fr);
    gap: 18px;
    align-items: stretch;
    background:
        radial-gradient(circle at top right, rgba(37, 211, 102, 0.10), transparent 32%),
        linear-gradient(135deg, #f8fffc 0%, #ffffff 55%, #f4fbf7 100%);
    border-color: rgba(23, 84, 63, 0.12);
    box-shadow: 0 18px 44px rgba(12, 42, 31, 0.08);
}

.dashboard-hero-copy {
    min-width: 0;
}

.dashboard-eyebrow {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    background: rgba(37, 211, 102, 0.12);
    color: var(--forest-700);
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.dashboard-hero-copy h3 {
    margin: 14px 0 8px;
    font-size: 32px;
    line-height: 1.15;
    color: var(--forest-900);
}

.dashboard-hero-copy p {
    margin: 0;
    max-width: 700px;
    color: var(--slate-600);
    font-size: 14.5px;
    line-height: 1.7;
}

.dashboard-hero-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.dashboard-hero-pills span,
.dashboard-panel-chip,
.dashboard-focus-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 12px;
    border-radius: var(--radius-pill);
    background: var(--paper);
    border: 1px solid var(--line);
    color: var(--slate-600);
    font-size: 12px;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

.dashboard-hero-pills strong {
    color: var(--forest-900);
    font-size: 14px;
}

.dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.dashboard-kpi-card {
    min-width: 0;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--paper);
    box-shadow: var(--shadow-sm);
}

.dashboard-kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--slate-600);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.dashboard-kpi-icon {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border-radius: 8px;
    background: color-mix(in srgb, currentColor 12%, transparent);
    font-size: 14px;
    font-weight: 800;
}

.dashboard-kpi-card > strong {
    display: block;
    margin-top: 12px;
    overflow: hidden;
    color: var(--forest-900);
    font-family: var(--font-display);
    font-size: clamp(20px, 2vw, 28px);
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-kpi-card > small {
    display: block;
    margin-top: 8px;
    overflow: hidden;
    color: var(--slate-500);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-kpi-card.tone-blue { color: var(--sky-500); }
.dashboard-kpi-card.tone-purple { color: #8b5cf6; }
.dashboard-kpi-card.tone-green { color: var(--leaf-600); }
.dashboard-kpi-card.tone-teal { color: #0f9f91; }
.dashboard-kpi-card.tone-danger { color: var(--coral-500); }
.dashboard-kpi-card.tone-amber { color: #c78a16; }
.dashboard-kpi-card.tone-wallet { color: #a66a00; }

@media (max-width: 1400px) {
    .dashboard-kpi-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.dashboard-message-analytics-panel {
    margin-bottom: 18px;
}

.dashboard-funnel-panel {
    margin-bottom: 18px;
}

.dashboard-funnel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
}

.dashboard-funnel-stage {
    min-width: 0;
    padding: 16px;
    border: 1px solid color-mix(in srgb, currentColor 24%, var(--line));
    border-radius: var(--radius-md);
    background: color-mix(in srgb, currentColor 7%, var(--paper));
}

.dashboard-funnel-label,
.dashboard-funnel-stage small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-funnel-label {
    color: var(--slate-600);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.dashboard-funnel-stage strong {
    display: block;
    margin: 10px 0 7px;
    color: var(--forest-900);
    font-family: var(--font-display);
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1;
}

.dashboard-funnel-stage small {
    color: var(--slate-500);
    font-size: 11px;
}

.dashboard-funnel-stage.tone-blue { color: var(--sky-500); }
.dashboard-funnel-stage.tone-green { color: var(--leaf-600); }
.dashboard-funnel-stage.tone-teal { color: #0f9f91; }
.dashboard-funnel-stage.tone-danger { color: var(--coral-500); }

.dashboard-funnel-arrow {
    color: var(--slate-400);
    font-size: 22px;
    font-weight: 700;
}

.dashboard-action-panel {
    margin-bottom: 18px;
}

.dashboard-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
}

.dashboard-action-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    padding: 15px;
    border: 1px solid var(--line);
    border-left: 4px solid currentColor;
    border-radius: var(--radius-md);
    background: var(--paper);
    color: var(--slate-600);
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dashboard-action-card:hover {
    color: var(--slate-600);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.dashboard-action-card.is-warning { color: #b7791f; background: #fffaf0; }
.dashboard-action-card.is-danger { color: var(--coral-500); background: #fff7f5; }
.dashboard-action-card.is-info { color: var(--sky-500); background: #f4fbff; }
.dashboard-action-card.is-healthy { color: var(--leaf-600); background: #f3fff7; }

.dashboard-action-status {
    align-self: flex-start;
    margin-bottom: 10px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.dashboard-action-card strong {
    color: var(--forest-900);
    font-size: 14px;
}

.dashboard-action-card small {
    margin-top: 6px;
    color: var(--slate-600);
    font-size: 12px;
    line-height: 1.5;
}

.dashboard-action-link {
    margin-top: auto;
    padding-top: 14px;
    color: currentColor;
    font-size: 12px;
    font-weight: 800;
}

.dashboard-message-analytics-header {
    align-items: center;
}

.dashboard-chart-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px 14px;
    color: var(--slate-600);
    font-size: 11px;
    font-weight: 700;
}

.dashboard-chart-legend span::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 5px;
    border-radius: 50%;
    background: currentColor;
}

.dashboard-chart-legend .legend-sent { color: #16a34a; }
.dashboard-chart-legend .legend-delivered { color: #0284c7; }
.dashboard-chart-legend .legend-read { color: #8b5cf6; }
.dashboard-chart-legend .legend-failed { color: #dc2626; }
.dashboard-chart-legend .legend-incoming { color: #d97706; }

.dashboard-message-chart-wrap {
    overflow-x: auto;
    padding-bottom: 4px;
}

.dashboard-message-chart {
    display: grid;
    grid-template-columns: repeat(30, minmax(18px, 1fr));
    align-items: end;
    gap: 7px;
    min-width: 720px;
    min-height: 230px;
    padding: 18px 4px 0;
    border-bottom: 1px solid var(--line);
}

.dashboard-message-chart-day {
    display: grid;
    grid-template-rows: 190px 20px;
    align-items: end;
    min-width: 0;
    color: var(--slate-500);
    font-size: 10px;
    text-align: center;
}

.dashboard-message-chart-bars {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
    height: 190px;
    padding: 0 1px;
    background: repeating-linear-gradient(to top, transparent 0, transparent 46px, color-mix(in srgb, var(--line) 70%, transparent) 47px);
}

.dashboard-message-chart-bars i {
    display: block;
    width: 100%;
    min-height: 2px;
    border-radius: 3px 3px 0 0;
}

.dashboard-message-chart-bars .bar-sent { background: #16a34a; }
.dashboard-message-chart-bars .bar-delivered { background: #0284c7; }
.dashboard-message-chart-bars .bar-read { background: #8b5cf6; }
.dashboard-message-chart-bars .bar-failed { background: #dc2626; }
.dashboard-message-chart-bars .bar-incoming { background: #d97706; }

@media (max-width: 800px) {
    .dashboard-message-analytics-header {
        align-items: flex-start;
    }

    .dashboard-chart-legend {
        justify-content: flex-start;
    }

    .dashboard-funnel {
        grid-template-columns: 1fr;
    }

    .dashboard-funnel-arrow {
        justify-self: center;
        transform: rotate(90deg);
    }
}

.dashboard-panel-heading {
    display: grid;
    gap: 10px;
}

.dashboard-panel-heading h3 {
    margin: 0;
}

.dashboard-panel-heading p {
    margin: 0;
}

.dashboard-panel-filter {
    display: grid;
    gap: 6px;
    width: fit-content;
}

.dashboard-panel-filter label {
    color: var(--slate-600);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.dashboard-panel-filter select {
    min-width: 180px;
    border-radius: 999px;
    background: var(--paper);
    border-color: var(--line);
    box-shadow: var(--shadow-sm);
    padding: 10px 14px;
}

.dashboard-focus {
    position: relative;
    overflow: hidden;
    display: grid;
    gap: 14px;
    padding: 22px;
    background: linear-gradient(180deg, rgba(12, 42, 31, 0.02), rgba(255, 255, 255, 0.92));
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow-md);
}

.dashboard-focus::before {
    content: "";
    position: absolute;
    inset: auto -30px -30px auto;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 211, 102, 0.12), transparent 68%);
    pointer-events: none;
}

.dashboard-focus-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.dashboard-focus-label {
    color: var(--slate-600);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.dashboard-focus-title {
    position: relative;
    font-family: var(--font-display);
    font-size: 24px;
    color: var(--forest-900);
}

.dashboard-focus-value-wrap {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.dashboard-focus-value {
    position: relative;
    font-family: var(--font-display);
    font-size: 44px;
    line-height: 0.95;
    color: var(--forest-900);
}

.dashboard-focus-value-wrap span {
    color: var(--slate-600);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.dashboard-focus-note {
    margin: 0;
    color: var(--slate-600);
    font-size: 13px;
    line-height: 1.6;
}

.dashboard-focus-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.dashboard-focus-stats span {
    display: grid;
    gap: 4px;
    padding: 11px 12px;
    border-radius: 16px;
    background: var(--mint-50);
    border: 1px solid var(--line);
    color: var(--slate-600);
    font-size: 12px;
    font-weight: 700;
}

.dashboard-focus-stats strong {
    color: var(--forest-900);
    font-size: 16px;
    font-family: var(--font-display);
}

.dashboard-period-grid,
.dashboard-metric-grid {
    display: grid;
    gap: 14px;
    margin-bottom: 18px;
}

.dashboard-period-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.dashboard-metric-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.dashboard-metric-card {
    position: relative;
    overflow: hidden;
    display: grid;
    gap: 10px;
    min-height: 170px;
    padding: 18px;
    text-align: left;
    border: 1px solid var(--line);
    border-radius: 22px;
    background:
        radial-gradient(circle at top right, var(--card-soft, rgba(37, 211, 102, 0.08)), transparent 70%),
        linear-gradient(180deg, var(--paper) 0%, var(--mint-50) 100%);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.dashboard-metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--card-accent, var(--leaf-500));
}

.dashboard-metric-card:focus-visible {
    outline: 2px solid var(--card-accent, var(--leaf-500));
    outline-offset: 3px;
}

.dashboard-metric-card.is-active {
    border-color: var(--card-accent, var(--leaf-500));
    box-shadow: 0 18px 38px rgba(37, 211, 102, 0.14);
    transform: translateY(-2px);
}

.dashboard-card-kicker {
    color: var(--slate-600);
    font-size: 11.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.dashboard-card-value {
    font-family: var(--font-display);
    font-size: 36px;
    color: var(--forest-900);
    line-height: 1;
}

.dashboard-card-note {
    color: var(--slate-600);
    font-size: 13px;
    line-height: 1.55;
    min-height: 40px;
}

.dashboard-card-chip {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 6px 10px;
    border-radius: var(--radius-pill);
    background: var(--card-soft, var(--leaf-100));
    color: var(--card-accent, var(--forest-700));
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.dashboard-card-mini-bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 26px;
    margin-top: auto;
}

.dashboard-card-mini-bars i {
    width: 8px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--card-accent, var(--leaf-500)), var(--card-soft, var(--leaf-100)));
    opacity: 0.92;
    transform: scaleY(0.35);
    transform-origin: bottom;
}

.dashboard-card-mini-bars i:nth-child(1) { height: 40%; }
.dashboard-card-mini-bars i:nth-child(2) { height: 62%; }
.dashboard-card-mini-bars i:nth-child(3) { height: 48%; }
.dashboard-card-mini-bars i:nth-child(4) { height: 78%; }

.tone-green {
    --card-accent: var(--leaf-600);
    --card-soft: var(--leaf-100);
}

.tone-emerald {
    --card-accent: var(--forest-700);
    --card-soft: var(--leaf-100);
}

.tone-blue {
    --card-accent: var(--sky-500);
    --card-soft: var(--sky-100);
}

.tone-amber {
    --card-accent: var(--gold-500);
    --card-soft: var(--gold-100);
}

.tone-danger {
    --card-accent: var(--coral-500);
    --card-soft: var(--coral-100);
}

.tone-purple {
    --card-accent: #7b67f2;
    --card-soft: #f0edff;
}

.tone-gray {
    --card-accent: var(--slate-600);
    --card-soft: var(--line-soft);
}

.tone-teal {
    --card-accent: #1f9e8c;
    --card-soft: #def8f2;
}

.dashboard-analytics-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.95fr);
    gap: 20px;
    margin-bottom: 20px;
    align-items: start;
}

.dashboard-trend-panel,
.dashboard-message-panel,
.dashboard-table-panel {
    position: relative;
}

.dashboard-chart-scroll {
    overflow-x: auto;
    padding-bottom: 6px;
}

.dashboard-chart {
    display: grid;
    grid-template-columns: repeat(12, minmax(44px, 1fr));
    gap: 10px;
    align-items: end;
    min-width: 640px;
    padding: 6px 2px 10px;
}

.dashboard-chart-column {
    display: grid;
    gap: 8px;
    justify-items: center;
    color: var(--slate-600);
    font-size: 12px;
}

.dashboard-chart-track {
    position: relative;
    width: 100%;
    min-height: 180px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    border-radius: 18px 18px 10px 10px;
    background: linear-gradient(180deg, rgba(37, 211, 102, 0.05), rgba(37, 211, 102, 0.02));
    border: 1px solid var(--line-soft);
    padding: 10px 8px;
    overflow: hidden;
}

.dashboard-chart-fill {
    width: 100%;
    max-width: 30px;
    height: 100%;
    min-height: 12px;
    border-radius: 999px 999px 12px 12px;
    background: linear-gradient(180deg, var(--leaf-500), var(--forest-700));
    box-shadow: 0 10px 18px rgba(37, 211, 102, 0.18);
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 0.9s ease;
}

.dashboard-animate .dashboard-chart-fill {
    transform: scaleY(var(--fill-scale, 1));
}

.dashboard-year-strip {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.dashboard-year-item {
    display: grid;
    gap: 8px;
    padding: 13px 14px;
    border-radius: 18px;
    background: var(--mint-50);
    border: 1px solid var(--line);
}

.dashboard-year-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--slate-600);
}

.dashboard-year-top strong {
    color: var(--forest-900);
}

.dashboard-inline-bar {
    height: 10px;
    border-radius: 999px;
    background: var(--line-soft);
    overflow: hidden;
}

.dashboard-inline-bar i {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--leaf-500), var(--forest-700));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.9s ease;
}

.dashboard-animate .dashboard-inline-bar i {
    transform: scaleX(var(--progress-scale, 1));
}

.dashboard-status-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.dashboard-status-strip span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-pill);
    background: var(--paper);
    border: 1px solid var(--line);
    color: var(--slate-600);
    font-size: 12px;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

.dashboard-status-strip strong {
    color: var(--forest-900);
}

.dashboard-period-summary {
    display: grid;
    gap: 10px;
    margin: 18px 0 8px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, #ffffff 0%, #f8fdfa 100%);
}

.dashboard-period-summary p {
    margin: 0;
    color: var(--slate-600);
    font-size: 13px;
    line-height: 1.5;
}

.dashboard-message-bars {
    display: grid;
    gap: 14px;
}

.dashboard-message-row {
    display: grid;
    gap: 10px;
    padding: 14px 14px 12px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: var(--mint-50);
}

.dashboard-message-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: baseline;
}

.dashboard-message-top span {
    color: var(--forest-900);
    font-size: 13px;
    font-weight: 800;
}

.dashboard-message-top strong {
    font-family: var(--font-display);
    font-size: 20px;
    color: var(--forest-900);
}

.dashboard-progress {
    height: 12px;
    border-radius: 999px;
    background: var(--line-soft);
    overflow: hidden;
}

.dashboard-progress i {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--card-accent, var(--leaf-500)), var(--card-soft, var(--leaf-100)));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.9s ease;
}

.dashboard-animate .dashboard-progress i {
    transform: scaleX(var(--progress-scale, 1));
}

.dashboard-message-row small {
    color: var(--slate-400);
    font-size: 11.5px;
    font-weight: 700;
}

.dashboard-ring-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.dashboard-ring-card {
    display: grid;
    gap: 10px;
    justify-items: center;
    text-align: center;
    padding: 16px 14px 18px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, #ffffff 0%, #f8fdfa 100%);
}

.dashboard-ring-label {
    color: var(--slate-600);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.dashboard-ring {
    --ring-color: var(--leaf-500);
    width: 116px;
    height: 116px;
    border-radius: 50%;
    position: relative;
    display: grid;
    place-items: center;
    background: conic-gradient(var(--ring-color) 0 var(--value), var(--line-soft) var(--value) 100%);
    box-shadow: inset 0 0 0 1px rgba(6, 34, 25, 0.04);
}

.dashboard-ring::before {
    content: "";
    position: absolute;
    inset: 14px;
    border-radius: 50%;
    background: var(--paper);
    box-shadow: inset 0 0 0 1px var(--line);
}

.dashboard-ring strong {
    position: relative;
    z-index: 1;
    font-family: var(--font-display);
    font-size: 22px;
    color: var(--forest-900);
}

.dashboard-ring.tone-blue {
    --ring-color: var(--sky-500);
}

.dashboard-ring.tone-amber {
    --ring-color: var(--gold-500);
}

.dashboard-ring-card p {
    margin: 0;
    color: var(--slate-600);
    font-size: 13px;
    line-height: 1.5;
}

.dashboard-empty-note {
    display: grid;
    gap: 6px;
    padding: 18px;
    border-radius: 18px;
    background: var(--mint-50);
    border: 1px dashed var(--line);
    color: var(--slate-600);
}

.dashboard-empty-note strong {
    color: var(--forest-900);
}

.dashboard-table-panel .table-wrap {
    overflow-x: auto;
}

.dashboard-table {
    min-width: 760px;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form, .form-grid {
    display: grid;
    gap: 12px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form label,
label {
    font-weight: 700;
    font-size: 13.5px;
    color: var(--forest-800);
}

input, select, textarea {
    width: 100%;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    outline: none;
    background: var(--paper);
    font-size: 14px;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--leaf-500);
    box-shadow: 0 0 0 4px rgba(37, 211, 102, 0.14);
}

textarea {
    resize: vertical;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500 !important;
}

.check-row input {
    width: auto;
}

.helper-text {
    margin: 2px 0 0;
    color: var(--slate-400);
    font-size: 12.5px;
}

.info-list {
    margin: 0;
    padding-left: 18px;
    color: var(--slate-600);
    line-height: 1.9;
    font-size: 13.5px;
}

.search-form {
    display: flex;
    gap: 10px;
    min-width: 320px;
}

.contact-filter-form {
    flex-wrap: wrap;
    justify-content: flex-end;
    min-width: min(100%, 720px);
}

.contact-filter-form input,
.contact-filter-form select {
    width: auto;
    min-width: 150px;
}

.contact-filter-form input[name="search"] {
    min-width: 220px;
}

.grid-2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 0.7fr);
    gap: 20px;
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table-wrap, .contact-select-table-wrap, .campaign-recipient-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    white-space: normal;
    table-layout: auto;
}

.data-table {
    white-space: normal;
}

th {
    text-align: left;
    color: var(--slate-600);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1.5px solid var(--line);
    padding: 12px;
    overflow-wrap: anywhere;
}

td {
    border-bottom: 1px solid var(--line-soft);
    padding: 13px 12px;
    overflow-wrap: anywhere;
    vertical-align: top;
    font-size: 14px;
}

tbody tr:hover {
    background: var(--mint-50);
}

.empty, .empty-state-large {
    text-align: center;
    color: var(--slate-600);
    padding: 40px 20px !important;
}

.empty-state-large h3 {
    margin: 0 0 8px;
    color: var(--forest-900);
}

.empty.wide {
    grid-column: 1 / -1;
}

.center-actions {
    justify-content: center;
}

.extra-data-cell {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--slate-600);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   Badges & status pills
   Signature motif: WhatsApp-style tick states
   ========================================================================== */

.badge {
    display: inline-flex;
    padding: 5px 11px;
    border-radius: var(--radius-pill);
    background: var(--leaf-100);
    color: var(--forest-700);
    font-size: 12px;
    font-weight: 800;
    text-transform: capitalize;
}

.badge.success {
    background: var(--leaf-100);
    color: #0f5c30;
}

.badge.danger {
    background: var(--coral-100);
    color: var(--coral-500);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 5px 11px;
    border-radius: var(--radius-pill);
    font-size: 11.5px;
    font-weight: 800;
    text-transform: capitalize;
    background: var(--line-soft);
    color: var(--slate-600);
}

.status-draft { background: #eef2f0; color: var(--slate-600); }
.status-pending, .status-ready_for_approval { background: var(--gold-100); color: #8a5f14; }
.status-scheduled, .status-retry_scheduled { background: var(--gold-100); color: #8a5f14; }
.status-processing { background: var(--sky-100); color: #146388; }
.status-sent { background: var(--line-soft); color: var(--slate-600); }
.status-sent::before { content: "\2713"; margin-right: 4px; }
.status-delivered { background: var(--leaf-100); color: #0f5c30; }
.status-delivered::before { content: "\2713\2713"; margin-right: 4px; }
.status-read { background: var(--sky-100); color: #146388; }
.status-read::before { content: "\2713\2713"; margin-right: 4px; color: var(--sky-500); }
.status-approved { background: var(--leaf-100); color: #0f5c30; }
.status-failed, .status-rejected { background: var(--coral-100); color: var(--coral-500); }
.status-action_required { background: var(--coral-100); color: var(--coral-500); }

.meta-status-pill {
    display: inline-flex;
    padding: 5px 11px;
    border-radius: var(--radius-pill);
    background: var(--sky-100);
    color: #146388;
    font-size: 11px;
    font-weight: 800;
}

/* ==========================================================================
   Auth pages (login / register)
   ========================================================================== */

.auth-body {
    margin: 0;
    min-height: 100vh;
    background: var(--mint-50);
    display: flex;
}

.auth-login-bg {
    background: radial-gradient(circle at 15% 15%, rgba(37, 211, 102, 0.14), transparent 55%),
        var(--mint-50);
}

.login-shell {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-shell {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    min-height: 100vh;
}

.auth-brand-panel {
    background: linear-gradient(160deg, var(--sidebar-bg-1), var(--leaf-100));
    color: var(--forest-900);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px;
    gap: 40px;
    border-right: 1px solid var(--sidebar-line);
}

.auth-logo {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 22px;
    letter-spacing: 0.04em;
    color: var(--forest-900);
}

.auth-logo span {
    color: var(--leaf-600);
}

.auth-brand-copy h1 {
    font-size: 38px;
    line-height: 1.2;
    margin: 0 0 14px;
    color: var(--forest-900);
}

.auth-brand-copy p {
    color: var(--slate-600);
    font-size: 15.5px;
    line-height: 1.6;
    max-width: 380px;
}

.auth-form-panel {
    display: grid;
    place-items: center;
    padding: 40px;
    background: var(--mint-50);
}

.auth-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 34px;
    width: 100%;
    max-width: 400px;
    display: grid;
    gap: 12px;
}

.auth-card.compact {
    max-width: 380px;
}

.auth-card h2 {
    margin: 0;
    font-size: 24px;
    color: var(--forest-900);
}

.auth-card > p {
    margin: -4px 0 6px;
    color: var(--slate-600);
    font-size: 14px;
}

.password-field {
    position: relative;
    display: flex;
    align-items: center;
}

.password-field input {
    padding-right: 56px;
}

.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(20, 83, 45, 0.12);
    background: rgba(220, 252, 231, 0.82);
    color: var(--forest-800);
    border-radius: 12px;
    padding: 0;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.password-toggle svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.password-toggle .eye-off,
.password-toggle.is-visible .eye-on {
    display: none;
}

.password-toggle.is-visible .eye-off {
    display: block;
}

.password-toggle:hover {
    background: var(--leaf-500);
    color: #06331d;
    box-shadow: 0 8px 18px rgba(34, 197, 94, 0.22);
}

.password-toggle:focus-visible {
    outline: 3px solid rgba(34, 197, 94, 0.35);
    outline-offset: 2px;
}

.auth-submit {
    margin-top: 8px;
    width: 100%;
}

.auth-switch {
    text-align: center;
    margin-top: 6px;
    font-size: 13.5px;
    color: var(--slate-600);
}

.auth-switch a {
    color: var(--leaf-600);
    font-weight: 800;
}

/* ==========================================================================
   Onboarding
   ========================================================================== */

.meta-onboarding-hero, .wa-settings-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    background: linear-gradient(135deg, var(--leaf-100), var(--sidebar-bg-1));
    color: var(--forest-900);
    padding: 30px 32px;
    border-radius: var(--radius-lg);
    margin-bottom: 22px;
    border: 1px solid var(--sidebar-line);
    box-shadow: var(--shadow-sm);
}

.meta-step-badge {
    display: inline-block;
    background: var(--paper);
    color: var(--leaf-600);
    font-size: 11.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    margin-bottom: 12px;
    border: 1px solid var(--line);
}

.meta-onboarding-hero h2, .wa-settings-hero h2 {
    margin: 0 0 8px;
    font-size: 25px;
    color: var(--forest-900);
}

.meta-onboarding-hero p, .wa-settings-hero p {
    margin: 0;
    color: var(--slate-600);
    max-width: 520px;
    line-height: 1.6;
    font-size: 14.5px;
}

.wa-settings-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.onboarding-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.onboarding-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.onboarding-icon {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-pill);
    background: var(--leaf-100);
    color: var(--forest-700);
    font-weight: 800;
    font-size: 14px;
    margin-bottom: 12px;
}

.onboarding-card h3 {
    margin: 0 0 6px;
    font-size: 15.5px;
    color: var(--forest-900);
}

.onboarding-card p {
    margin: 0;
    color: var(--slate-600);
    font-size: 13px;
    line-height: 1.55;
}

/* ==========================================================================
   Meta Connect
   ========================================================================== */

.meta-connect-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr);
    gap: 20px;
    align-items: start;
}

.meta-checklist {
    background: var(--mint-50);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    margin-bottom: 18px;
}

.meta-checklist h4 {
    margin: 0 0 10px;
    color: var(--forest-900);
}

.meta-checklist ul {
    margin: 0;
    padding-left: 18px;
    color: var(--slate-600);
    font-size: 13.5px;
    line-height: 1.9;
}

.meta-connect-button {
    width: 100%;
    font-size: 15px;
    padding: 14px;
}

.meta-connect-status {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    display: none;
}

.meta-connect-status:not(:empty) {
    display: block;
}

.meta-connect-status.info { background: var(--sky-100); color: #146388; }
.meta-connect-status.success { background: var(--leaf-100); color: #0f5c30; }
.meta-connect-status.error { background: var(--coral-100); color: var(--coral-500); }

.connected-box {
    background: var(--leaf-100);
    border: 1px solid #b9edcd;
    border-radius: var(--radius-md);
    padding: 20px;
}

.connected-box h4 {
    margin: 0 0 10px;
    color: #0f5c30;
}

.connected-box p {
    margin: 4px 0;
    font-size: 13.5px;
    color: var(--forest-800);
}

.connected-box .actions {
    margin-top: 14px;
}

.meta-status-list {
    display: grid;
    gap: 12px;
}

.meta-status-list > div {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--line-soft);
    font-size: 13.5px;
}

.meta-status-list span {
    color: var(--slate-600);
}

.meta-status-list strong {
    color: var(--forest-900);
}

/* ==========================================================================
   WhatsApp Settings
   ========================================================================== */

.wa-connection-grid, .wa-phone-info-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.wa-connection-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 18px;
    box-shadow: var(--shadow-sm);
}

.wa-connection-card.success {
    background: var(--leaf-100);
    border-color: #b9edcd;
}

.wa-connection-card span {
    display: block;
    color: var(--slate-600);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.wa-connection-card strong {
    display: block;
    margin-top: 8px;
    font-size: 17px;
    color: var(--forest-900);
    word-break: break-word;
}

.wa-connection-card p {
    margin: 6px 0 0;
    color: var(--slate-600);
    font-size: 12.5px;
}

.wa-phone-info-grid > div {
    background: var(--mint-50);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 16px;
}

.wa-phone-info-grid span {
    display: block;
    color: var(--slate-600);
    font-size: 12px;
    font-weight: 700;
}

.wa-phone-info-grid strong {
    display: block;
    margin-top: 6px;
    color: var(--forest-900);
}

.meta-test-box {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: var(--mint-50);
}

.meta-test-box strong {
    display: block;
    margin-bottom: 4px;
    color: var(--forest-900);
}

.meta-test-box p {
    margin: 0;
    color: var(--slate-600);
    font-size: 13.5px;
}

.meta-test-box small {
    display: block;
    margin-top: 6px;
    color: var(--slate-400);
}

.meta-test-box.success { background: var(--leaf-100); border-color: #b9edcd; }
.meta-test-box.failed { background: var(--coral-100); border-color: #f6c6bc; }
.meta-test-box.info { background: var(--sky-100); border-color: #bfe6f7; }

.readiness-list {
    display: grid;
    gap: 12px;
}

.readiness-list > div {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: var(--mint-50);
}

.readiness-list span {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: var(--radius-pill);
    font-weight: 800;
    font-size: 13px;
}

.readiness-list .ready span { background: var(--leaf-100); color: #0f5c30; }
.readiness-list .pending span { background: var(--gold-100); color: #8a5f14; }

.readiness-list strong {
    display: block;
    color: var(--forest-900);
    font-size: 14px;
}

.readiness-list p {
    margin: 3px 0 0;
    color: var(--slate-600);
    font-size: 13px;
}

/* ==========================================================================
   Templates
   ========================================================================== */

.template-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
    padding: 28px 30px;
    border: 1px solid rgba(23, 84, 63, 0.12);
    border-radius: 28px;
    background:
        radial-gradient(circle at top right, rgba(177, 233, 219, 0.55), transparent 32%),
        linear-gradient(135deg, #f8fffc 0%, #eef8f3 54%, #ffffff 100%);
    box-shadow: 0 24px 60px rgba(10, 42, 28, 0.08);
}

.template-hero-copy {
    max-width: 640px;
}

.template-hero h2 {
    margin: 0 0 6px;
    font-size: 32px;
    color: #103728;
}

.template-hero p {
    margin: 0;
    color: #547267;
    max-width: 560px;
    font-size: 15px;
    line-height: 1.7;
}

.template-hero .actions {
    flex-shrink: 0;
}

.template-hero-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.template-hero-inline-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.template-hero-inline-stats span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 14px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(23, 84, 63, 0.08);
    color: #4a675c;
    font-size: 12px;
    font-weight: 700;
}

.template-hero-inline-stats strong {
    color: #123b2a;
    font-size: 13px;
}

.template-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.template-stat-card {
    background: linear-gradient(180deg, #ffffff 0%, #f7fbf9 100%);
    border: 1px solid rgba(24, 87, 65, 0.1);
    border-radius: 22px;
    padding: 20px;
    box-shadow: 0 16px 34px rgba(12, 42, 31, 0.06);
}

.template-stat-card span {
    display: block;
    color: #688276;
    font-size: 12.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.template-stat-card strong {
    display: block;
    margin-top: 8px;
    font-size: 30px;
    color: #103728;
    font-family: var(--font-display);
}

.template-stat-card p {
    margin: 8px 0 0;
    color: #6b8579;
    font-size: 12.5px;
    line-height: 1.5;
}

.template-guide-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.template-guide-panel,
.template-flow-panel {
    border-radius: 24px;
    box-shadow: 0 18px 44px rgba(16, 55, 40, 0.06);
}

.template-flow {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.template-flow > div {
    background: linear-gradient(180deg, #f7fbf8 0%, #ffffff 100%);
    border: 1px solid rgba(28, 92, 69, 0.1);
    border-radius: 18px;
    padding: 16px;
}

.template-flow span {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: var(--radius-pill);
    background: var(--leaf-100);
    color: var(--leaf-600);
    font-weight: 800;
    font-size: 12.5px;
    margin-bottom: 10px;
}

.template-flow strong {
    display: block;
    color: var(--forest-900);
    font-size: 14px;
    margin-bottom: 4px;
}

.template-flow p {
    margin: 0;
    color: var(--slate-600);
    font-size: 12.5px;
    line-height: 1.5;
}

.preset-template-grid, .template-modern-grid, .quick-guide-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    gap: 16px;
}

.quick-guide-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.template-guide-link {
    display: flex;
    align-items: center;
    min-height: 68px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid rgba(23, 84, 63, 0.1);
    background: linear-gradient(180deg, #ffffff 0%, #f6fbf8 100%);
    color: #1d4d3a;
    font-weight: 700;
    line-height: 1.5;
    box-shadow: 0 14px 30px rgba(12, 42, 31, 0.04);
}

.template-guide-link:hover {
    color: #123b2a;
    border-color: rgba(23, 84, 63, 0.2);
    transform: translateY(-1px);
}

.preset-template-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 16px;
    background: var(--mint-50);
}

.preset-template-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.preset-template-top h4 {
    margin: 0;
    font-size: 15px;
    color: var(--forest-900);
}

.preset-template-top p {
    margin: 4px 0 0;
    color: var(--slate-600);
    font-size: 12px;
    text-transform: capitalize;
}

.mini-wa-preview {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 12px;
    min-height: 132px;
}

.mini-wa-preview strong {
    display: block;
    margin-bottom: 4px;
    color: var(--forest-900);
}

.mini-wa-preview p {
    margin: 0;
    color: var(--ink-900);
}

.mini-wa-preview small {
    display: block;
    margin-top: 6px;
    color: var(--slate-400);
}

.mini-wa-preview button {
    margin-top: 10px;
    width: 100%;
    border: 1px solid var(--line);
    background: var(--sky-100);
    color: #146388;
    border-radius: 8px;
    padding: 8px;
    font-weight: 700;
    font-size: 12.5px;
}

.mini-media-placeholder {
    background: var(--line-soft);
    border: 1px dashed var(--line);
    color: var(--slate-600);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.template-search-box input {
    min-width: 280px;
    border-radius: 999px;
    border: 1px solid rgba(23, 84, 63, 0.14);
    background: #fbfefc;
    padding-left: 16px;
}

.template-library-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.template-library-rail,
.template-library-main {
    border-radius: 26px;
    box-shadow: 0 22px 50px rgba(12, 42, 31, 0.06);
}

.template-library-rail {
    position: sticky;
    top: 96px;
    padding: 22px;
    background: linear-gradient(180deg, #f8fcfa 0%, #ffffff 100%);
}

.template-library-rail-head h3 {
    margin: 14px 0 8px;
    color: #143728;
    font-size: 22px;
}

.template-library-rail-head p {
    margin: 0;
    color: #678175;
    font-size: 13px;
    line-height: 1.6;
}

.template-rail-section + .template-rail-section {
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid rgba(23, 84, 63, 0.08);
}

.template-rail-label {
    display: block;
    margin-bottom: 12px;
    color: #6a8277;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.template-rail-links {
    display: grid;
    gap: 8px;
}

.template-rail-links button {
    text-align: left;
    padding: 11px 14px;
    border-radius: 14px;
    border: 1px solid transparent;
    background: transparent;
    color: #355a4a;
    font-weight: 700;
    cursor: pointer;
}

.template-rail-links button.active {
    background: #e8f5ef;
    border-color: rgba(23, 84, 63, 0.1);
    color: #123b2a;
}

.template-rail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.template-rail-tags button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    border-radius: var(--radius-pill);
    background: #f3f8f5;
    border: 1px solid rgba(23, 84, 63, 0.08);
    color: #537065;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.template-rail-tags button.active,
.template-rail-tags button:hover {
    background: #e8f5ef;
    border-color: rgba(23, 84, 63, 0.18);
    color: #123b2a;
}

.template-rail-tags button strong {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    border-radius: var(--radius-pill);
    background: rgba(28, 108, 80, 0.1);
    font-size: 11px;
}

.template-rail-empty {
    color: var(--slate-500);
    font-size: 12.5px;
    line-height: 1.5;
}

.template-rail-summary {
    display: grid;
    gap: 12px;
}

.template-rail-summary div {
    padding: 16px;
    border-radius: 18px;
    background: linear-gradient(180deg, #f7fbf8 0%, #ffffff 100%);
    border: 1px solid rgba(23, 84, 63, 0.08);
}

.template-rail-summary strong {
    display: block;
    font-size: 24px;
    color: #123b2a;
    font-family: var(--font-display);
}

.template-rail-summary span {
    color: #688175;
    font-size: 12px;
    font-weight: 700;
}

.template-library-main {
    padding: 12px 16px 16px;
}

.template-library-main-head {
    align-items: center;
    padding-bottom: 6px;
}

.template-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.template-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
    padding: 0 20px 2px;
    border-bottom: 1px solid rgba(23, 84, 63, 0.08);
}

.template-tabs button {
    border: none;
    background: transparent;
    color: #6a8075;
    padding: 10px 4px 12px;
    border-radius: 0;
    font-weight: 700;
    font-size: 12.5px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
}

.template-tabs button.active {
    background: transparent;
    color: #123b2a;
    border-bottom-color: #1c6c50;
}

.template-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    padding: 0 0 20px;
    align-items: stretch;
}

.template-card {
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(23, 84, 63, 0.1);
    border-radius: 24px;
    padding: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfefc 100%);
    box-shadow: 0 18px 44px rgba(12, 42, 31, 0.05);
    min-height: 100%;
}

.template-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.template-card-top > div:first-child {
    min-width: 0;
}

.template-card-top h4 {
    margin: 0 0 8px;
    font-size: 17px;
    color: #123b2a;
    line-height: 1.35;
    word-break: break-word;
}

.template-card-icon {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    margin-bottom: 12px;
    border-radius: 14px;
    background: linear-gradient(135deg, #dff5ea 0%, #f4fbf7 100%);
    color: #1d6c4f;
    font-weight: 800;
}

.template-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.template-card-tags span {
    background: #f3f8f5;
    border: 1px solid rgba(23, 84, 63, 0.08);
    color: #5d766a;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: var(--radius-pill);
    text-transform: capitalize;
}

.template-card .meta-status-pill {
    flex: 0 0 auto;
    align-self: flex-start;
    padding: 7px 10px;
    border-radius: 14px;
    background: #e8f4fb;
    color: #155c83;
    font-size: 10.5px;
    font-weight: 800;
    line-height: 1.25;
    max-width: 96px;
    text-align: center;
    white-space: normal;
}

.template-meta-status {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 11.5px;
    color: #6d8379;
    margin-bottom: 12px;
}

.template-error-box {
    background: var(--coral-100);
    color: var(--coral-500);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 12.5px;
    margin-top: 10px;
}

.template-error-box a {
    color: var(--coral-500);
    font-weight: 700;
    text-decoration: underline;
}

body.modal-open {
    overflow: hidden;
}

.ui-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 30, 21, 0.52);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 1000;
}

.ui-modal-backdrop[hidden] {
    display: none !important;
}

.ui-modal-card {
    width: min(100%, 520px);
    background: linear-gradient(180deg, #ffffff 0%, #f7fdf9 100%);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    padding: 28px;
    position: relative;
}

.ui-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--paper);
    color: var(--slate-600);
    cursor: pointer;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

.ui-modal-badge {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: var(--radius-pill);
    background: var(--leaf-100);
    color: var(--forest-800);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ui-modal-card h3 {
    margin: 16px 0 10px;
    font-size: 24px;
    color: var(--forest-900);
}

.ui-modal-card p {
    margin: 0;
    color: var(--slate-600);
    line-height: 1.7;
    font-size: 14px;
}

.ui-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.template-sync-time {
    color: var(--slate-400);
    font-size: 11.5px;
    margin: 8px 0 0;
}

.template-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 14px;
}

.template-card-actions .btn {
    border-radius: 12px;
}

.template-filter-empty {
    display: grid;
    justify-items: center;
    gap: 10px;
    margin: 8px 0 18px;
    padding: 42px 24px;
    border: 1px dashed rgba(23, 84, 63, 0.18);
    border-radius: 24px;
    background: linear-gradient(180deg, #fbfefc 0%, #f3faf6 100%);
    text-align: center;
}

.template-filter-empty[hidden] {
    display: none !important;
}

.template-filter-empty-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: var(--leaf-100);
    color: var(--forest-800);
}

.template-filter-empty-icon svg {
    width: 26px;
    height: 26px;
}

.template-filter-empty h3 {
    margin: 0;
    color: var(--forest-900);
}

.template-filter-empty p {
    max-width: 480px;
    margin: 0;
    color: var(--slate-600);
    line-height: 1.6;
}

/* ==========================================================================
   Template builder (create/edit)
   ========================================================================== */

.template-builder-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr);
    gap: 20px;
    align-items: start;
}

.simple-template-button-builder {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 14px;
    background: var(--mint-50);
}

.simple-button-builder-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.simple-button-builder-head small {
    display: block;
    color: var(--slate-600);
    font-size: 12px;
    margin-top: 2px;
}

.simple-button-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 10px;
}

.template-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.sticky-preview, .sticky-panel {
    position: sticky;
    top: 20px;
}

.phone-preview {
    background: #eaf7ee;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--line);
}

.phone-top {
    background: var(--leaf-100);
    color: var(--forest-900);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--sidebar-line);
}

.wa-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-pill);
    background: var(--leaf-500);
    color: #06331d;
    display: grid;
    place-items: center;
    font-weight: 800;
}

.phone-top strong {
    display: block;
    font-size: 13.5px;
    color: var(--forest-900);
}

.phone-top small {
    color: var(--leaf-600);
    font-size: 11px;
}

.phone-chat {
    padding: 18px 14px;
    min-height: 220px;
}

.wa-message-bubble {
    background: var(--paper);
    border-radius: 4px 14px 14px 14px;
    padding: 12px 14px;
    max-width: 90%;
    box-shadow: var(--shadow-sm);
    font-size: 13.5px;
    line-height: 1.55;
}

.wa-media-preview img, .wa-media-preview video {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 8px;
    display: block;
}

.wa-media-placeholder {
    background: var(--line-soft);
    color: var(--slate-600);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.wa-document-preview {
    background: var(--line-soft);
    border-radius: 8px;
    padding: 14px;
    font-size: 12.5px;
    margin-bottom: 8px;
}

.wa-header-preview {
    font-weight: 800;
    color: var(--forest-900);
    margin-bottom: 6px;
}

.wa-header-preview:empty, .wa-footer-preview:empty {
    display: none;
}

.wa-body-preview {
    color: var(--ink-900);
    white-space: pre-wrap;
}

.wa-footer-preview {
    margin-top: 8px;
    color: var(--slate-400);
    font-size: 12px;
}

.wa-buttons-preview {
    display: grid;
    gap: 6px;
    margin-top: 10px;
}

.wa-buttons-preview button {
    border: none;
    border-top: 1px solid var(--line-soft);
    background: transparent;
    color: var(--sky-500);
    font-weight: 700;
    font-size: 12.5px;
    padding-top: 8px;
    cursor: pointer;
}

.wa-time {
    margin-top: 8px;
    text-align: right;
    color: var(--slate-400);
    font-size: 10.5px;
}

.preview-sample-data {
    margin-top: 14px;
    background: var(--mint-50);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 14px;
}

.preview-sample-data strong {
    color: var(--forest-900);
    font-size: 12.5px;
}

.preview-sample-data pre {
    margin: 8px 0 0;
    color: var(--slate-600);
    font-family: var(--font-mono);
    font-size: 11px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ==========================================================================
   Campaign builder
   ========================================================================== */

.campaign-builder-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
    gap: 20px;
    align-items: start;
}

.template-preview-box {
    margin-bottom: 16px;
}

.template-body-preview {
    background: var(--mint-50);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 13.5px;
    color: var(--slate-600);
    white-space: pre-wrap;
    margin-top: 6px;
}

.component-mapping-wrapper {
    display: grid;
    gap: 18px;
    margin-top: 16px;
}

.component-mapping-section {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--mint-50);
    padding: 16px;
}

.component-mapping-section h4 {
    margin: 0 0 6px;
    color: var(--forest-900);
    font-size: 14.5px;
}

.component-mapping-section p {
    margin: 0 0 14px;
    color: var(--slate-600);
    font-size: 12.5px;
}

.variable-mapping-list {
    display: grid;
    gap: 10px;
}

.variable-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 16px;
    align-items: center;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: border-color 0.15s ease;
}

.variable-row:hover {
    border-color: #cbd5e1;
}

.variable-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.variable-label strong {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #16a34a;
    font-family: var(--font-mono);
    background: #f0fdf4;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid #dcfce7;
    width: fit-content;
}

.variable-label small {
    display: block;
    color: #64748b;
    font-size: 12px;
    line-height: 1.3;
}

.variable-control {
    display: grid;
    gap: 8px;
}

.variable-control select {
    height: 38px;
    padding: 0 12px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    font-size: 13.5px;
    color: #0f172a;
    background: #ffffff;
    transition: border-color 0.15s ease;
}

.variable-control select:focus {
    border-color: #16a34a;
    outline: none;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
}

.variable-custom-input {
    display: none;
    height: 36px;
    padding: 0 12px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    font-size: 13px;
    background: #ffffff;
}

.variable-custom-input:focus {
    border-color: #16a34a;
    outline: none;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
}

/* ========================================================================== 
   TEMPLATE BUILDER VARIABLE HELPER TOOLBAR & SAMPLE VALUES
   ========================================================================== */

.template-variable-helper-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    margin-top: 10px;
}

.variable-toolbar-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
}

.variable-toolbar-chips {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.btn-var-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 11.5px;
    font-family: var(--font-mono);
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-var-chip:hover {
    background: #f0fdf4;
    border-color: #16a34a;
    color: #15803d;
}

.btn-var-chip.btn-var-next {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #16a34a;
    font-weight: 600;
}

.btn-var-chip.btn-var-next:hover {
    background: #dcfce7;
    border-color: #86efac;
}

.template-builder-layout textarea#tb-body {
    border-radius: 0 0 6px 6px !important;
    margin-top: 0 !important;
}

/* Sample Values Container */
.template-sample-values-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px 16px;
    margin-top: 14px;
}

.sample-values-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 12px;
}

.sample-values-header strong {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
}

.sample-values-header small {
    font-size: 12px;
    color: #64748b;
}

.sample-values-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.sample-value-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sample-value-field label {
    font-size: 11.5px;
    font-weight: 600;
    font-family: var(--font-mono);
    color: #16a34a;
    margin: 0;
}

.sample-value-field input {
    height: 34px;
    padding: 0 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
    background: #ffffff;
}

.sample-value-field input:focus {
    border-color: #16a34a;
    outline: none;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
}

:root[data-theme="dark"] .variable-row,
:root[data-theme="dark"] .template-variable-helper-toolbar,
:root[data-theme="dark"] .template-sample-values-card {
    background: #0f172a !important;
    border-color: #1e293b !important;
}

:root[data-theme="dark"] .btn-var-chip {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}

:root[data-theme="dark"] .btn-var-chip:hover {
    background: rgba(22, 163, 74, 0.2) !important;
    border-color: #22c55e !important;
    color: #4ade80 !important;
}

:root[data-theme="dark"] .sample-value-field input,
:root[data-theme="dark"] .variable-control select,
:root[data-theme="dark"] .variable-custom-input {
    background: #020617 !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}


.send-mode-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.send-mode-card {
    display: flex;
    gap: 12px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: pointer;
    background: var(--mint-50);
}

.send-mode-card input {
    width: auto;
    accent-color: var(--leaf-500);
}

.send-mode-card strong {
    display: block;
    color: var(--forest-900);
    font-size: 14px;
}

.send-mode-card small {
    display: block;
    margin-top: 4px;
    color: var(--slate-600);
    line-height: 1.5;
    font-size: 12.5px;
}

.schedule-box {
    margin-top: 16px;
}

.final-message-preview {
    background: var(--mint-50);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-size: 13.5px;
    color: var(--ink-900);
    white-space: pre-wrap;
    line-height: 1.6;
}

.tag-filter-inline {
    display: flex;
    gap: 10px;
    align-items: center;
}

.tag-filter-inline select {
    min-width: 180px;
}

.footer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 30px;
}

.actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.message-preview {
    max-width: 320px;
    white-space: pre-wrap;
    color: var(--slate-600);
    font-size: 13px;
}

/* ==========================================================================
   Campaign detail
   ========================================================================== */

.campaign-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.campaign-summary-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 18px;
}

.campaign-summary-card span {
    display: block;
    color: var(--slate-600);
    font-size: 11.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 8px;
}

.campaign-summary-card strong {
    display: block;
    font-size: 19px;
    color: var(--forest-900);
    word-break: break-word;
    font-family: var(--font-display);
}

.campaign-summary-card p {
    margin: 8px 0 0;
    color: var(--slate-600);
    font-size: 12.5px;
}

.preflight-summary {
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
}

.preflight-summary strong {
    display: block;
    margin-bottom: 6px;
}

.preflight-summary p {
    margin: 0;
    line-height: 1.6;
    font-size: 13.5px;
}

.preflight-summary.success {
    background: var(--leaf-100);
    border-color: #b9edcd;
    color: #0f5c30;
}

.preflight-summary.failed {
    background: var(--coral-100);
    border-color: #f6c6bc;
    color: #8f2e1c;
}

.preflight-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: 14px;
}

.preflight-card {
    display: flex;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--mint-50);
    padding: 14px;
}

.preflight-card span {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-pill);
    font-weight: 900;
    flex: 0 0 auto;
}

.preflight-card.ready span, .campaign-readiness-strip .ready span {
    background: var(--leaf-100);
    color: #0f5c30;
}

.preflight-card.failed span, .campaign-readiness-strip .failed span {
    background: var(--coral-100);
    color: var(--coral-500);
}

.preflight-card strong {
    display: block;
    margin-bottom: 4px;
    color: var(--forest-900);
}

.preflight-card p {
    margin: 0;
    color: var(--slate-600);
    line-height: 1.5;
    font-size: 13px;
}

.campaign-readiness-strip > div {
    display: flex;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 16px;
    background: var(--mint-50);
}

.campaign-readiness-strip strong {
    display: block;
    color: var(--forest-900);
    margin-bottom: 4px;
}

.campaign-readiness-strip p {
    margin: 0;
    color: var(--slate-600);
    font-size: 13px;
}

.recipient-status-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(90px, 1fr));
    gap: 12px;
}

.recipient-status-grid article {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--mint-50);
    padding: 14px;
    text-align: center;
}

.recipient-status-grid span {
    display: block;
    color: var(--slate-600);
    font-size: 11px;
    font-weight: 800;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.recipient-status-grid strong {
    display: block;
    font-size: 21px;
    color: var(--forest-800);
    font-family: var(--font-display);
}

.recipient-message-preview {
    max-width: 340px;
    white-space: pre-wrap;
    line-height: 1.5;
    color: var(--slate-600);
    font-size: 13px;
}

.recipient-error {
    max-width: 260px;
    color: var(--coral-500);
    white-space: pre-wrap;
    font-size: 12.5px;
}

.attempt-debug-details {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--mint-50);
    padding: 12px;
}

.attempt-debug-details summary {
    cursor: pointer;
    font-weight: 800;
    color: var(--leaf-600);
    font-size: 13px;
}

.attempt-debug-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 12px;
}

.attempt-debug-grid strong {
    display: block;
    margin-bottom: 8px;
    color: var(--forest-900);
    font-size: 12.5px;
}

.attempt-debug-grid pre {
    max-height: 280px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--mint-50);
    color: var(--forest-800);
    padding: 12px;
    font-size: 11.5px;
    font-family: var(--font-mono);
}

/* ==========================================================================
   Queue Control / Sending Controls
   ========================================================================== */

.queue-control-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 14px;
}

.queue-control-grid article {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--mint-50);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.queue-control-grid article.running {
    border-color: #b9edcd;
    background: var(--leaf-100);
}

.queue-control-grid article.paused {
    border-color: #f6c6bc;
    background: var(--coral-100);
}

.queue-control-grid span {
    display: block;
    color: var(--slate-600);
    font-size: 11.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 8px;
}

.queue-control-grid strong {
    display: block;
    font-size: 18px;
    color: var(--forest-900);
    word-break: break-word;
    font-family: var(--font-display);
}

.queue-control-grid p {
    margin: 8px 0 0;
    color: var(--slate-600);
    line-height: 1.5;
    font-size: 12.5px;
}

.sending-controls-form {
    display: grid;
    gap: 16px;
}


/* ==========================================================================
   Manual send
   ========================================================================== */

.manual-send-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}

.manual-send-hero h3 {
    margin: 0 0 6px;
    color: var(--forest-900);
}

.manual-send-hero p {
    margin: 0;
    color: var(--slate-600);
    font-size: 13.5px;
}

.manual-info-box {
    background: var(--sky-100);
    border: 1px solid #bfe6f7;
    border-radius: var(--radius-md);
    padding: 16px;
}

.manual-info-box strong {
    display: block;
    margin-bottom: 6px;
    color: #146388;
}

.manual-info-box p {
    margin: 0;
    color: #1b5a78;
    font-size: 13.5px;
    line-height: 1.6;
}

.manual-send-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(240px, 1fr));
    gap: 16px;
}

.manual-send-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 16px;
    background: var(--mint-50);
}

.manual-send-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.manual-send-top h4 {
    margin: 0;
    font-size: 14.5px;
    color: var(--forest-900);
}

.manual-send-top p {
    margin: 4px 0 0;
    color: var(--slate-600);
    font-size: 12.5px;
}

.manual-message-preview {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    margin-bottom: 12px;
}

.manual-send-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.manual-sent-label {
    color: var(--slate-400);
    font-size: 12.5px;
    font-weight: 700;
}

/* ==========================================================================
   Webhook logs
   ========================================================================== */

.webhook-log-list {
    display: grid;
    gap: 12px;
}

.webhook-log-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    background: var(--mint-50);
}

.webhook-log-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.webhook-log-top strong {
    color: var(--forest-900);
    font-size: 13.5px;
}

.webhook-log-top span {
    margin-left: 8px;
    color: var(--leaf-600);
    font-size: 12px;
    font-weight: 700;
}

.webhook-log-top small {
    color: var(--slate-400);
    font-size: 11.5px;
}

.webhook-log-card pre {
    margin: 0;
    background: var(--paper);
    border: 1px solid var(--line);
    color: var(--forest-800);
    padding: 12px;
    border-radius: 10px;
    font-family: var(--font-mono);
    font-size: 11.5px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}


/* ==========================================================================
   Developer  Mode
   ========================================================================== */
.developer-mode-banner {
    position: sticky;
    top: 0;
    z-index: 9999;
    background: #fef3c7;
    color: #92400e;
    border-bottom: 1px solid #fde68a;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 900;
    text-align: center;
}

/* Worker Health */
.worker-health-grid,
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(170px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.worker-health-card,
.analytics-grid article {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 18px;
    box-shadow: var(--shadow-sm);
}

.worker-health-card.success {
    background: var(--leaf-100);
    border-color: #b9edcd;
}

.worker-health-card.danger,
.worker-event-card.error {
    background: var(--coral-100);
    border-color: #f6c6bc;
}

.worker-health-card span,
.analytics-grid span {
    display: block;
    color: var(--slate-600);
    font-size: 11.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 8px;
}

.worker-health-card strong,
.analytics-grid strong {
    display: block;
    font-size: 20px;
    color: var(--forest-900);
    word-break: break-word;
    font-family: var(--font-display);
}

.worker-health-card p,
.analytics-grid p {
    margin: 8px 0 0;
    color: var(--slate-600);
    line-height: 1.5;
    font-size: 12.5px;
}

.worker-debug-box pre,
.worker-event-card pre {
    margin: 0;
    background: var(--mint-50);
    border: 1px solid var(--line);
    color: var(--forest-800);
    padding: 12px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 11.5px;
    white-space: pre-wrap;
    word-break: break-word;
    overflow: auto;
}

.worker-event-list {
    display: grid;
    gap: 12px;
}

.worker-event-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 14px;
    background: var(--mint-50);
}

.worker-event-card small {
    display: block;
    color: var(--slate-400);
    margin: 4px 0 10px;
}

/* WhatsApp-style Inbox */
.wa-inbox-shell,
.wa-conversation-shell {
    border: 1px solid #d5e6dd;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background:
        radial-gradient(circle at 18% 8%, rgba(37, 211, 102, 0.12), transparent 28%),
        linear-gradient(135deg, #f7fffb 0%, #edf7f1 100%);
}

.wa-inbox-shell {
    min-height: 680px;
    display: grid;
    grid-template-columns: minmax(280px, 390px) minmax(0, 1fr);
}

.wa-chat-list {
    border-right: 1px solid #d6e7df;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(12px);
}

.wa-chat-list-header,
.wa-conversation-header {
    min-height: 82px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: linear-gradient(135deg, #075e54 0%, #0f7b64 100%);
    color: #fff;
}

.wa-chat-list-header {
    justify-content: space-between;
}

.wa-kicker {
    display: inline-flex;
    margin-bottom: 4px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.wa-chat-list-header h3,
.wa-conversation-header h3 {
    margin: 0;
    color: #fff;
}

.wa-online-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--leaf-500);
    box-shadow: 0 0 0 6px rgba(37, 211, 102, 0.18);
}

.wa-search-pill {
    margin: 16px;
    padding: 11px 14px;
    display: flex;
    gap: 8px;
    align-items: center;
    border-radius: var(--radius-pill);
    background: #f0f6f3;
    color: var(--slate-500);
    font-size: 12px;
}

.wa-search-pill strong {
    color: var(--forest-900);
    font-weight: 700;
}

.wa-chat-items {
    display: grid;
}

.wa-chat-row {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #edf5f0;
    transition: background 0.18s ease, transform 0.18s ease;
}

.wa-chat-row:hover {
    background: #eef8f2;
    transform: translateX(2px);
}

.wa-avatar {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 50%;
    background: linear-gradient(135deg, #dff6eb 0%, #bceccd 100%);
    color: #075e54;
    font-weight: 900;
    box-shadow: inset 0 0 0 1px rgba(7, 94, 84, 0.08);
}

.wa-chat-row-main {
    min-width: 0;
}

.wa-chat-row-top,
.wa-chat-row-bottom,
.conversation-meta,
.wa-message-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.wa-chat-row-top strong {
    min-width: 0;
    overflow: hidden;
    color: var(--forest-900);
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wa-chat-row-top time {
    flex: 0 0 auto;
    color: var(--slate-400);
    font-size: 11px;
}

.wa-chat-row-bottom {
    margin-top: 5px;
}

.wa-chat-row-bottom p {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: var(--slate-600);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wa-chat-row small {
    display: block;
    margin-top: 5px;
    color: var(--slate-400);
    font-size: 11px;
    text-transform: capitalize;
}

.wa-unread-count {
    min-width: 22px;
    height: 22px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: var(--leaf-500);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
}

.wa-inbox-preview {
    display: grid;
    place-items: center;
    padding: 30px;
}

.wa-preview-card,
.wa-empty-chat-list {
    max-width: 430px;
    text-align: center;
    color: var(--slate-600);
}

.wa-preview-card h3,
.wa-empty-chat-list h3 {
    margin: 16px 0 8px;
    color: var(--forest-900);
}

.wa-preview-card p,
.wa-empty-chat-list p {
    margin: 0;
    line-height: 1.65;
}

.wa-preview-art {
    width: 150px;
    height: 150px;
    margin: 0 auto;
    position: relative;
    border-radius: 44px;
    background: linear-gradient(145deg, #dcf8c6, #eef8f2);
    box-shadow: var(--shadow-md);
}

.wa-preview-art span {
    position: absolute;
    left: 28px;
    right: 28px;
    height: 16px;
    border-radius: var(--radius-pill);
    background: #fff;
}

.wa-preview-art span:nth-child(1) {
    top: 42px;
}

.wa-preview-art span:nth-child(2) {
    top: 68px;
    left: 46px;
    background: #dcf8c6;
}

.wa-preview-art span:nth-child(3) {
    top: 94px;
}

.wa-empty-icon {
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    margin: 32px auto 0;
    border-radius: 50%;
    background: var(--leaf-100);
    color: var(--forest-900);
    font-size: 24px;
    font-weight: 900;
}

.wa-conversation-shell {
    min-height: 720px;
    display: grid;
    grid-template-rows: auto 1fr auto;
}

.wa-back-link {
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: var(--radius-pill);
    padding: 8px 12px;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.wa-contact-title {
    min-width: 0;
    flex: 1;
}

.wa-contact-title p {
    margin: 4px 0 0;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wa-thread-badge {
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: var(--radius-pill);
    padding: 8px 11px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
    font-weight: 800;
}

.wa-chat-wall {
    position: relative;
    display: grid;
    align-content: end;
    gap: 12px;
    padding: 28px;
    background-color: #efeae2;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(7, 94, 84, 0.06) 1px, transparent 0),
        linear-gradient(135deg, rgba(255, 255, 255, 0.6), rgba(220, 248, 198, 0.18));
    background-size: 26px 26px, auto;
}

.wa-day-chip {
    justify-self: center;
    border-radius: var(--radius-pill);
    padding: 7px 12px;
    background: rgba(255, 255, 255, 0.8);
    color: var(--slate-500);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    box-shadow: var(--shadow-sm);
}

.conversation-message {
    display: flex;
}

.conversation-message.incoming {
    justify-content: flex-start;
}

.conversation-message.outgoing {
    justify-content: flex-end;
}

.conversation-bubble {
    position: relative;
    max-width: min(680px, 78%);
    width: fit-content;
    border-radius: 14px;
    background: #fff;
    padding: 11px 13px 9px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
}

.conversation-message.outgoing .conversation-bubble {
    background: #dcf8c6;
}

.conversation-message.incoming .conversation-bubble::before,
.conversation-message.outgoing .conversation-bubble::before {
    content: "";
    position: absolute;
    top: 0;
    width: 0;
    height: 0;
    border-top: 10px solid currentColor;
}

.conversation-message.incoming .conversation-bubble::before {
    left: -8px;
    color: #fff;
    border-left: 10px solid transparent;
}

.conversation-message.outgoing .conversation-bubble::before {
    right: -8px;
    color: #dcf8c6;
    border-right: 10px solid transparent;
}

.conversation-meta {
    margin-bottom: 7px;
    color: #5b6f66;
    font-size: 11px;
}

.conversation-bubble p {
    margin: 0;
    color: #16362b;
    line-height: 1.55;
    white-space: pre-wrap;
}

.wa-message-foot {
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 8px;
    color: #6f8178;
    font-size: 10.5px;
}

.wa-status-pill {
    border-radius: var(--radius-pill);
    padding: 3px 7px;
    background: rgba(7, 94, 84, 0.08);
    color: #075e54;
    font-weight: 800;
    text-transform: capitalize;
}

.wa-status-pill.failed {
    background: var(--coral-100);
    color: var(--coral-500);
}

.wa-status-pill.delivered,
.wa-status-pill.read,
.wa-status-pill.sent {
    background: rgba(37, 211, 102, 0.18);
    color: #0f7b64;
}

.wa-composer {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 14px 18px;
    background: #f0f2f5;
    border-top: 1px solid #d6e1db;
}

.wa-composer-plus {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #fff;
    color: #075e54;
    font-size: 20px;
    font-weight: 900;
}

.wa-composer div {
    border-radius: var(--radius-pill);
    padding: 12px 16px;
    background: #fff;
    color: var(--slate-500);
    font-size: 13px;
}

.wa-empty-thread {
    align-self: center;
    justify-self: center;
    background: rgba(255, 255, 255, 0.78);
}

:root[data-theme="dark"] .wa-inbox-shell,
:root[data-theme="dark"] .wa-conversation-shell {
    border-color: #1f363a;
    background:
        radial-gradient(circle at 18% 8%, rgba(37, 211, 102, 0.12), transparent 28%),
        linear-gradient(135deg, #0b171a 0%, #111f23 100%);
}

:root[data-theme="dark"] .wa-chat-list {
    border-color: #1f363a;
    background: rgba(17, 31, 35, 0.9);
}

:root[data-theme="dark"] .wa-chat-list-header,
:root[data-theme="dark"] .wa-conversation-header {
    background: linear-gradient(135deg, #111b21 0%, #202c33 100%);
}

:root[data-theme="dark"] .wa-search-pill {
    background: #202c33;
}

:root[data-theme="dark"] .wa-chat-row {
    border-color: #1f363a;
}

:root[data-theme="dark"] .wa-chat-row:hover {
    background: #1a2c30;
}

:root[data-theme="dark"] .wa-avatar {
    background: linear-gradient(135deg, #0f7b64 0%, #123f2b 100%);
    color: #e7fff2;
}

:root[data-theme="dark"] .wa-chat-row-top strong,
:root[data-theme="dark"] .wa-preview-card h3,
:root[data-theme="dark"] .wa-empty-chat-list h3 {
    color: var(--forest-900);
}

:root[data-theme="dark"] .wa-inbox-preview {
    background:
        radial-gradient(circle at 70% 20%, rgba(37, 211, 102, 0.08), transparent 24%),
        linear-gradient(135deg, rgba(17, 27, 33, 0.6), rgba(11, 20, 22, 0.86));
}

:root[data-theme="dark"] .wa-preview-art {
    background: linear-gradient(145deg, #111b21, #202c33);
}

:root[data-theme="dark"] .wa-preview-art span {
    background: #2a3942;
}

:root[data-theme="dark"] .wa-preview-art span:nth-child(2) {
    background: #005c4b;
}

:root[data-theme="dark"] .wa-chat-wall {
    background-color: #0b141a;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(233, 243, 239, 0.045) 1px, transparent 0),
        linear-gradient(135deg, rgba(17, 27, 33, 0.68), rgba(0, 92, 75, 0.12));
}

:root[data-theme="dark"] .wa-day-chip,
:root[data-theme="dark"] .conversation-message.incoming .conversation-bubble {
    background: #202c33;
    color: #c9d7d1;
}

:root[data-theme="dark"] .conversation-message.outgoing .conversation-bubble {
    background: #005c4b;
}

:root[data-theme="dark"] .conversation-message.incoming .conversation-bubble::before {
    color: #202c33;
}

:root[data-theme="dark"] .conversation-message.outgoing .conversation-bubble::before {
    color: #005c4b;
}

:root[data-theme="dark"] .conversation-bubble p {
    color: #e9edef;
}

:root[data-theme="dark"] .conversation-meta,
:root[data-theme="dark"] .wa-message-foot {
    color: #9fb0aa;
}

:root[data-theme="dark"] .wa-status-pill {
    background: rgba(37, 211, 102, 0.14);
    color: #9ff0bd;
}

:root[data-theme="dark"] .wa-composer {
    border-color: #1f363a;
    background: #202c33;
}

:root[data-theme="dark"] .wa-composer-plus,
:root[data-theme="dark"] .wa-composer div {
    background: #111b21;
    color: #c9d7d1;
}
/* Customer WhatsApp Connection */
.customer-wa-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    align-items: start;
}

.customer-wa-main,
.customer-wa-side {
    background: var(--mint-50);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 18px;
}

.customer-wa-side h4 {
    margin: 0 0 10px;
    color: var(--forest-900);
}

.customer-wa-side ol {
    margin: 0;
    padding-left: 18px;
    color: var(--slate-600);
    line-height: 1.7;
    font-size: 13px;
}

.customer-wa-alert,
.customer-wa-result {
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 14px;
    font-weight: 700;
    line-height: 1.45;
}

.customer-wa-alert.success,
.customer-wa-result.success {
    background: var(--leaf-100);
    border: 1px solid #b9edcd;
    color: var(--forest-900);
}

.customer-wa-alert.warning,
.customer-wa-result.info {
    background: #fff7d6;
    border: 1px solid #f4df94;
    color: #7a5600;
}

.customer-wa-alert.danger,
.customer-wa-result.error {
    background: var(--coral-100);
    border: 1px solid #f6c6bc;
    color: #7a1c12;
}

.customer-wa-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.inline-form {
    display: inline-flex;
    margin: 0;
}

.customer-wa-detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 14px;
}

.customer-wa-detail-grid > div {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 14px;
}

.customer-wa-detail-grid span {
    display: block;
    color: var(--slate-600);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 8px;
}

.customer-wa-detail-grid strong {
    display: block;
    color: var(--forest-900);
    font-size: 14px;
    word-break: break-word;
}

.retry-phone-registration-btn {
    margin-top: 10px;
    width: 100%;
}

/* ==========================================================================
   Scrollbar
   ========================================================================== */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--mint-50);
}

::-webkit-scrollbar-thumb {
    background: #9fc4b1;
    border-radius: 20px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1100px) {
    .stats-grid, .contact-select-grid, .template-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-period-grid,
    .dashboard-metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-analytics-grid,
    .dashboard-hero {
        grid-template-columns: 1fr;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .manual-send-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .wa-connection-grid, .wa-phone-info-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .campaign-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .recipient-status-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .template-stats-grid, .template-flow {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-ring-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .template-guide-shell,
    .template-library-shell {
        grid-template-columns: 1fr;
    }

    .template-library-rail {
        position: static;
    }
}

@media (max-width: 1000px) {
    .campaign-builder-grid, .template-builder-layout {
        grid-template-columns: 1fr;
    }

    .sticky-panel, .sticky-preview {
        position: static;
    }
}

@media (max-width: 900px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-brand-panel {
        min-height: 260px;
        padding: 40px;
    }

    .auth-brand-copy h1 {
        font-size: 30px;
    }

    .onboarding-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .meta-connect-layout {
        grid-template-columns: 1fr;
    }

    .meta-onboarding-hero, .wa-settings-hero, .template-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .template-toolbar,
    .template-hero-actions,
    .template-hero-copy,
    .template-library-main {
        width: 100%;
    }

    .template-search-box input {
        min-width: 100%;
    }

    .attempt-debug-grid {
        grid-template-columns: 1fr;
    }
    .queue-control-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .worker-health-grid,
    .analytics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .customer-wa-layout,
    .customer-wa-detail-grid,
    .wa-inbox-shell {
        grid-template-columns: 1fr;
    }

    .wa-chat-list {
        border-right: 0;
        border-bottom: 1px solid #d6e7df;
    }

    .wa-inbox-preview {
        min-height: 260px;
    }

    .conversation-bubble {
        max-width: 88%;
    }
}

@media (max-width: 800px) {
    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        overflow: visible;
    }

    .app-shell {
        display: block;
    }

    .main {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
        padding: 18px;
    }

    :root[data-sidebar="collapsed"] .sidebar {
        width: 100%;
        padding: 24px 16px;
    }

    :root[data-sidebar="collapsed"] .main {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
    }

    :root[data-sidebar="collapsed"] .brand {
        justify-content: flex-start;
        gap: 12px;
    }

    :root[data-sidebar="collapsed"] .nav {
        justify-items: stretch;
    }

    :root[data-sidebar="collapsed"] .nav a {
        font-size: 14px;
        justify-content: flex-start;
        gap: 11px;
        padding-left: 12px;
        padding-right: 12px;
    }

    :root[data-sidebar="collapsed"] .brand h1,
    :root[data-sidebar="collapsed"] .sidebar-user-copy,
    :root[data-sidebar="collapsed"] .sidebar-theme-toggle .theme-toggle-label,
    :root[data-sidebar="collapsed"] .sidebar-logout span,
    :root[data-sidebar="collapsed"] .developer-mode-banner {
        opacity: 1;
        visibility: visible;
        width: auto;
        padding: initial;
        margin: initial;
        pointer-events: auto;
    }

    .topbar, .panel-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .stats-grid, .template-card-grid, .onboarding-grid, .preset-template-grid,
    .template-modern-grid, .quick-guide-grid, .template-stats-grid, .template-flow {
        grid-template-columns: 1fr;
    }

    .template-hero {
        padding: 22px;
    }

    .template-tabs {
        padding-left: 0;
        padding-right: 0;
    }

    .template-card-grid {
        padding-left: 0;
        padding-right: 0;
    }

    .dashboard-focus-stats {
        grid-template-columns: 1fr;
    }

    .dashboard-chart {
        min-width: 560px;
    }

    .dashboard-panel-filter select {
        min-width: 160px;
    }

    .search-form {
        min-width: 100%;
    }

    .variable-row {
        grid-template-columns: 1fr;
    }

    .send-mode-grid {
        grid-template-columns: 1fr;
    }

    .simple-button-row {
        grid-template-columns: 1fr;
    }

    .manual-send-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .manual-send-grid {
        grid-template-columns: 1fr;
    }

    .preflight-grid {
        grid-template-columns: 1fr;
    }

    .campaign-summary-grid, .recipient-status-grid {
        grid-template-columns: 1fr;
    }

    .wa-connection-grid, .wa-phone-info-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-period-grid,
    .dashboard-metric-grid,
    .dashboard-ring-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-panel-heading,
    .dashboard-panel-filter {
        width: 100%;
    }

    .dashboard-panel-filter select {
        width: 100%;
        min-width: 0;
    }

    .dashboard-focus-value {
        font-size: 36px;
    }

    .dashboard-hero-copy h3 {
        font-size: 28px;
    }

    .dashboard-chart {
        min-width: 520px;
    }

    .wa-conversation-header {
        flex-wrap: wrap;
    }

    .wa-thread-badge {
        display: none;
    }

    .wa-chat-wall {
        padding: 18px 14px;
    }

    .wa-composer {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .wa-composer .btn {
        grid-column: 1 / -1;
        justify-self: stretch;
        text-align: center;
    }
}

@media (max-width: 600px) {
    .auth-body {
        padding: 14px;
    }

    .dashboard-hero,
    .dashboard-focus,
    .dashboard-period-card,
    .dashboard-metric-card,
    .dashboard-trend-panel,
    .dashboard-message-panel,
    .dashboard-table-panel {
        border-radius: 18px;
    }

    .dashboard-card-value {
        font-size: 30px;
    }

    .dashboard-ring {
        width: 100px;
        height: 100px;
    }

    .dashboard-ring strong {
        font-size: 18px;
    }

    .queue-control-grid {
        grid-template-columns: 1fr;
    }
    .worker-health-grid,
    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .wa-chat-list-header,
    .wa-conversation-header {
        padding: 16px;
    }

    .wa-chat-row {
        grid-template-columns: 42px minmax(0, 1fr);
        padding: 12px;
    }

    .wa-avatar {
        width: 40px;
        height: 40px;
    }

    .conversation-bubble {
        max-width: 94%;
    }

    .main {
        padding: 14px 12px 40px;
    }

    .topbar h2 {
        font-size: 23px;
    }

    .topbar p {
        font-size: 13px;
    }

    .topbar-actions,
    .topbar-actions .btn,
    .contacts-action-bar > *,
    .contacts-action-bar .btn,
    .actions,
    .actions .btn,
    .footer-actions,
    .footer-actions .btn,
    .customer-wa-actions,
    .customer-wa-actions .btn,
    .wa-settings-actions,
    .wa-settings-actions .btn {
        width: 100%;
    }

    .topbar-actions,
    .actions,
    .footer-actions,
    .customer-wa-actions,
    .wa-settings-actions {
        align-items: stretch;
    }

    .topbar-actions .btn,
    .actions .btn,
    .footer-actions .btn,
    .customer-wa-actions .btn,
    .wa-settings-actions .btn {
        justify-content: center;
    }

    .panel,
    .modern-future-card,
    .customer-wa-main,
    .customer-wa-side {
        padding: 16px;
    }

    .panel-header,
    .future-card-header,
    .future-consent-banner,
    .unverified-banner,
    .unverified-banner-content {
        align-items: flex-start;
        flex-direction: column;
    }

    .future-consent-banner,
    .unverified-banner {
        gap: 12px;
    }

    .unverified-resend-btn {
        justify-content: center;
        width: 100%;
    }

    .contacts-tabs {
        width: 100%;
        overflow-x: auto;
    }

    .contact-tab-btn {
        flex: 1 0 auto;
        justify-content: center;
    }

    .table-wrap,
    .contact-select-table-wrap,
    .campaign-recipient-table-wrap,
    .simple-table-wrap,
    .doc-table-wrap,
    .documentation-table-wrap {
        overflow-x: auto;
        max-width: 100%;
    }

    .table-wrap table,
    .contact-select-table-wrap table,
    .campaign-recipient-table-wrap table,
    .simple-table-wrap table,
    .doc-table-wrap table,
    .documentation-table-wrap table {
        min-width: 620px;
    }

    .data-table th,
    .data-table td {
        white-space: nowrap;
    }
}

@media (max-width: 420px) {
    .sidebar {
        padding: 18px 12px;
    }

    .brand {
        gap: 8px;
    }

    .brand h1 {
        font-size: 20px;
    }

    .nav a {
        padding: 9px 10px;
        font-size: 13px;
    }

    .main {
        padding-left: 10px;
        padding-right: 10px;
    }

    .dashboard-hero-copy h3 {
        font-size: 24px;
    }

    .dashboard-focus-value {
        font-size: 32px;
    }

    .documentation-hero,
    .template-hero,
    .meta-onboarding-hero,
    .wa-settings-hero {
        padding: 18px;
    }
}

/* ========================================================================== 
   Unverified Email Alert Banner (Light & Dark Theme Adaptive)
   ========================================================================== */
.unverified-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    margin-bottom: 24px;
    border-radius: var(--radius-md, 14px);
    background: var(--leaf-100);
    border: 1px solid rgba(37, 211, 102, 0.25);
    border-left: 5px solid var(--leaf-500);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.unverified-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.unverified-banner-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    color: var(--forest-700);
}

.unverified-banner-text strong {
    font-size: 14px;
    font-weight: 700;
    color: var(--forest-900);
}

.unverified-banner-text span {
    font-size: 13.5px;
    color: var(--forest-800);
    margin-left: 4px;
}

.unverified-resend-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--leaf-500);
    color: #ffffff !important;
    border: none;
    font-size: 13px;
    font-weight: 700;
    padding: 8px 18px;
    border-radius: var(--radius-sm, 8px);
    white-space: nowrap;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
    transition: transform 0.15s ease, background 0.15s ease;
}

.unverified-resend-btn:hover {
    background: var(--leaf-600);
    transform: translateY(-1px);
}

:root[data-theme="dark"] .unverified-banner {
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.1) 0%, rgba(18, 140, 126, 0.15) 100%);
    border: 1px solid rgba(37, 211, 102, 0.35);
    border-left: 5px solid var(--leaf-500);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

:root[data-theme="dark"] .unverified-banner-text strong {
    color: #ffffff;
}

:root[data-theme="dark"] .unverified-banner-text span {
    color: #caf6df;
}

:root[data-theme="dark"] .unverified-banner-icon {
    color: #5cf08f;
}

/* ========================================================================== 
   PROFESSIONAL SAAS CONTACTS UI DESIGN (CLEAN, SUBTLE, PRODUCTION-GRADE)
   ========================================================================== */

.contacts-header-wrapper {
    margin-bottom: 20px;
}

/* KPI Overview Grid */
.contacts-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.contact-kpi-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.contact-kpi-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.06);
}

.contact-kpi-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    flex-shrink: 0;
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.contact-kpi-icon svg {
    width: 18px;
    height: 18px;
}

.contact-kpi-icon.green {
    background: #f0fdf4;
    color: #16a34a;
    border-color: #dcfce7;
}

.contact-kpi-icon.blue {
    background: #f0f9ff;
    color: #0284c7;
    border-color: #e0f2fe;
}

.contact-kpi-icon.amber {
    background: #fffbeb;
    color: #d97706;
    border-color: #fef3c7;
}

.contact-kpi-icon.purple {
    background: #faf5ff;
    color: #9333ea;
    border-color: #f3e8ff;
}

.contact-kpi-content {
    display: flex;
    flex-direction: column;
}

.contact-kpi-value {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
    font-family: var(--font-display);
}

.contact-kpi-label {
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    margin-top: 2px;
}

/* Action Bar & Tabs */
.contacts-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.contacts-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.contact-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: #475569;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.contact-tab-btn svg {
    width: 15px;
    height: 15px;
}

.contact-tab-btn:hover {
    color: #0f172a;
}

.contact-tab-btn.active {
    background: #ffffff;
    color: #0f172a;
    font-weight: 600;
    border-color: #e2e8f0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-sample-template {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #334155;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: all 0.15s ease;
}

.btn-sample-template:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}

/* ========================================================================== 
   PANELS & FORMS (CLEAN PRODUCTION DESIGN)
   ========================================================================== */

.modern-future-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.future-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f1f5f9;
}

.future-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.future-header-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #dcfce7;
    flex-shrink: 0;
}

.future-header-icon svg {
    width: 18px;
    height: 18px;
}

.future-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
    letter-spacing: -0.01em;
}

.future-card-subtitle {
    font-size: 13px;
    color: #64748b;
    margin: 2px 0 0;
}

.btn-future-close {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #64748b;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-future-close:hover {
    background: #fee2e2;
    border-color: #fecaca;
    color: #dc2626;
}

/* Form Fields */
.future-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.future-input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.future-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12.5px;
    font-weight: 600;
    color: #334155;
}

.future-label-hint {
    font-size: 11px;
    font-weight: 400;
    color: #94a3b8;
}

.future-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.future-input-wrap svg {
    position: absolute;
    left: 11px;
    width: 15px;
    height: 15px;
    color: #94a3b8;
    pointer-events: none;
    transition: color 0.15s ease;
}

.future-input-field {
    width: 100%;
    height: 38px;
    padding: 6px 12px 6px 34px !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    font-size: 13.5px !important;
    font-weight: 400 !important;
    color: #0f172a !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02) !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}

.future-input-field:focus {
    border-color: #16a34a !important;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12) !important;
    outline: none !important;
}

.future-input-field:focus + svg,
.future-input-field:focus ~ svg {
    color: #16a34a;
}

/* WhatsApp Opt-in Consent Card */
.future-consent-banner {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-top: 4px;
}

.future-consent-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.future-verified-shield {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #dcfce7;
    flex-shrink: 0;
}

.future-verified-shield svg {
    width: 16px;
    height: 16px;
}

.future-consent-title {
    font-size: 13.5px;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
}

.future-consent-desc {
    font-size: 12px;
    color: #64748b;
    margin: 2px 0 0;
}

/* Clean UI Switch */
.future-switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 22px;
    flex-shrink: 0;
}

.future-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.future-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.2s ease;
    border-radius: 22px;
}

.future-switch-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    transition: 0.2s ease;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.future-switch input:checked + .future-switch-slider {
    background-color: #16a34a;
}

.future-switch input:checked + .future-switch-slider:before {
    transform: translateX(16px);
}

/* Action Buttons */
.future-actions-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}

.btn-future-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 18px;
    background: #16a34a;
    color: #ffffff !important;
    border: none;
    border-radius: 6px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: background-color 0.15s ease;
}

.btn-future-primary:hover {
    background: #15803d;
}

.btn-future-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 16px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #334155;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.btn-future-secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}

/* CSV Dropzone */
.future-csv-dropzone {
    position: relative;
    border: 1.5px dashed #cbd5e1;
    border-radius: 8px;
    padding: 30px 20px;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.future-csv-dropzone:hover,
.future-csv-dropzone.drag-over {
    border-color: #16a34a;
    background: #f0fdf4;
}

.future-csv-dropzone input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.future-drop-icon {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: #ffffff;
    color: #16a34a;
    border: 1px solid #e2e8f0;
    margin-bottom: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.future-drop-icon svg {
    width: 22px;
    height: 22px;
}

.future-drop-title {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 3px;
}

.future-drop-desc {
    font-size: 12.5px;
    color: #64748b;
    margin: 0;
}

.future-features-row {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.future-feature-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 11.5px;
    font-weight: 500;
    color: #475569;
}

.future-file-chip {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
    padding: 5px 14px;
    background: #ffffff;
    border: 1px solid #16a34a;
    border-radius: 14px;
    font-size: 12.5px;
    font-weight: 600;
    color: #15803d;
}

/* ========================================================================== 
   INLINE VALIDATION ERRORS
   ========================================================================== */

.future-inline-error {
    display: none;
    align-items: center;
    gap: 4px;
    font-size: 11.5px;
    font-weight: 500;
    color: #dc2626;
    margin-top: 3px;
}

.future-inline-error svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.has-future-error .future-input-field {
    border-color: #ef4444 !important;
    background: #fff5f5 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.has-future-error .future-input-wrap svg {
    color: #ef4444 !important;
}

.has-future-error .future-inline-error {
    display: flex !important;
}

/* ========================================================================== 
   TABLE & DIRECTORY LAYOUT (CLEAN & METICULOUS)
   ========================================================================== */

.table-wrap table {
    width: 100%;
    border-collapse: collapse;
}

.table-wrap th {
    font-size: 11.5px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
    color: #64748b !important;
    padding: 10px 14px !important;
    border-bottom: 1px solid #e2e8f0 !important;
    background: #f8fafc !important;
    vertical-align: middle !important;
}

.table-wrap td {
    padding: 10px 14px !important;
    border-bottom: 1px solid #f1f5f9 !important;
    font-size: 13px !important;
    vertical-align: middle !important;
}

.table-wrap tr:hover td {
    background: #fafafa;
}

.contact-user-meta {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

.contact-avatar {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 600 !important;
    font-size: 12px !important;
    background: #f1f5f9 !important;
    color: #334155 !important;
    border: 1px solid #e2e8f0 !important;
    flex-shrink: 0 !important;
}

.contact-details {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
}

.contact-name-title {
    font-weight: 600 !important;
    color: #0f172a !important;
    font-size: 13.5px !important;
    line-height: 1.2 !important;
}

.contact-email-sub {
    font-size: 12px !important;
    color: #64748b !important;
    line-height: 1.2 !important;
}

.phone-badge-wrap {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-family: var(--font-mono) !important;
    font-size: 12.5px !important;
    color: #334155 !important;
}

.copy-phone-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 20px !important;
    height: 20px !important;
    background: transparent !important;
    border: none !important;
    color: #94a3b8 !important;
    cursor: pointer !important;
    border-radius: 4px !important;
    transition: color 0.15s ease;
}

.copy-phone-btn:hover {
    color: #16a34a !important;
}

.copy-phone-btn svg {
    width: 13px !important;
    height: 13px !important;
}

.tag-badge-pill {
    display: inline-block !important;
    padding: 2px 7px !important;
    background: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 4px !important;
    font-size: 11.5px !important;
    font-weight: 500 !important;
    margin: 1px !important;
}

.opt-in-pulse-badge {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 2px 8px !important;
    border-radius: 12px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    white-space: nowrap !important;
}

.opt-in-pulse-badge.yes {
    background: #f0fdf4 !important;
    color: #15803d !important;
    border: 1px solid #dcfce7 !important;
}

.opt-in-pulse-badge.no {
    background: #fef2f2 !important;
    color: #b91c1c !important;
    border: 1px solid #fee2e2 !important;
}

.pulse-dot {
    width: 6px !important;
    height: 6px !important;
    border-radius: 50% !important;
    background: currentColor !important;
}

/* ========================================================================== 
   DARK THEME REFINEMENTS
   ========================================================================== */

:root[data-theme="dark"] .contact-kpi-card,
:root[data-theme="dark"] .contacts-tabs,
:root[data-theme="dark"] .modern-future-card,
:root[data-theme="dark"] .btn-sample-template,
:root[data-theme="dark"] .btn-future-secondary,
:root[data-theme="dark"] .future-csv-dropzone,
:root[data-theme="dark"] .future-consent-banner {
    background: #0f172a !important;
    border-color: #1e293b !important;
    box-shadow: none !important;
}

:root[data-theme="dark"] .contact-kpi-value,
:root[data-theme="dark"] .future-card-title,
:root[data-theme="dark"] .future-consent-title,
:root[data-theme="dark"] .future-drop-title,
:root[data-theme="dark"] .contact-name-title {
    color: #f8fafc !important;
}

:root[data-theme="dark"] .contact-kpi-label,
:root[data-theme="dark"] .future-card-subtitle,
:root[data-theme="dark"] .future-consent-desc,
:root[data-theme="dark"] .future-drop-desc,
:root[data-theme="dark"] .contact-email-sub,
:root[data-theme="dark"] .phone-badge-wrap,
:root[data-theme="dark"] .future-label-hint {
    color: #94a3b8 !important;
}

:root[data-theme="dark"] .future-label {
    color: #e2e8f0 !important;
}

:root[data-theme="dark"] .future-input-field {
    background: #020617 !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

:root[data-theme="dark"] .future-input-field:focus {
    border-color: #22c55e !important;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15) !important;
}

:root[data-theme="dark"] .contact-tab-btn.active {
    background: #1e293b !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
}

:root[data-theme="dark"] .contact-kpi-icon {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}

:root[data-theme="dark"] .contact-kpi-icon.green {
    background: rgba(22, 163, 74, 0.15) !important;
    border-color: rgba(22, 163, 74, 0.3) !important;
    color: #4ade80 !important;
}

:root[data-theme="dark"] .table-wrap th {
    background: #020617 !important;
    border-color: #1e293b !important;
    color: #94a3b8 !important;
}

:root[data-theme="dark"] .table-wrap td {
    border-color: #1e293b !important;
}

:root[data-theme="dark"] .table-wrap tr:hover td {
    background: #1e293b !important;
}

:root[data-theme="dark"] .contact-avatar {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}

:root[data-theme="dark"] .tag-badge-pill {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}

:root[data-theme="dark"] .btn-future-close {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}

:root[data-theme="dark"] .future-feature-pill {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}

/* ========================================================================== 
   TEMPLATE QUALITY SCORE INDICATOR STYLING (META COMPLIANCE)
   ========================================================================== */

.quality-score-badge {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 3px 8px !important;
    border-radius: 12px !important;
    font-size: 11.5px !important;
    font-weight: 600 !important;
    letter-spacing: 0.02em !important;
    line-height: 1 !important;
    cursor: default !important;
    white-space: nowrap !important;
}

.quality-score-badge .quality-dot {
    width: 6px !important;
    height: 6px !important;
    border-radius: 50% !important;
    background: currentColor !important;
    display: inline-block !important;
}

/* High / Green */
.quality-score-badge.quality-high,
.quality-score-badge.quality-green {
    background: #f0fdf4 !important;
    color: #15803d !important;
    border: 1px solid #bbf7d0 !important;
}

/* Medium / Yellow / Amber */
.quality-score-badge.quality-medium,
.quality-score-badge.quality-yellow {
    background: #fffbeb !important;
    color: #b45309 !important;
    border: 1px solid #fde68a !important;
}

/* Low / Red */
.quality-score-badge.quality-low,
.quality-score-badge.quality-red {
    background: #fef2f2 !important;
    color: #b91c1c !important;
    border: 1px solid #fecaca !important;
}

/* Unknown / Unrated */
.quality-score-badge.quality-unknown,
.quality-score-badge.quality-unrated {
    background: #f8fafc !important;
    color: #64748b !important;
    border: 1px solid #e2e8f0 !important;
}

/* Paused */
.quality-score-badge.quality-paused {
    background: #fef2f2 !important;
    color: #dc2626 !important;
    border: 1px solid #fca5a5 !important;
}

/* Dark theme for Quality Badges */
:root[data-theme="dark"] .quality-score-badge.quality-high,
:root[data-theme="dark"] .quality-score-badge.quality-green {
    background: rgba(22, 163, 74, 0.15) !important;
    color: #4ade80 !important;
    border-color: rgba(34, 197, 94, 0.3) !important;
}

:root[data-theme="dark"] .quality-score-badge.quality-medium,
:root[data-theme="dark"] .quality-score-badge.quality-yellow {
    background: rgba(217, 119, 6, 0.15) !important;
    color: #fbbf24 !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
}

:root[data-theme="dark"] .quality-score-badge.quality-low,
:root[data-theme="dark"] .quality-score-badge.quality-red {
    background: rgba(220, 38, 38, 0.15) !important;
    color: #f87171 !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

:root[data-theme="dark"] .quality-score-badge.quality-unknown,
:root[data-theme="dark"] .quality-score-badge.quality-unrated {
    background: #1e293b !important;
    color: #94a3b8 !important;
    border-color: #334155 !important;
}

/* ==========================================================================
   Top-Right Floating Meta Connect Alert Toast (Brand Green)
   ========================================================================== */
.meta-connect-floating-toast {
    position: fixed;
    top: 20px;
    right: 24px;
    z-index: 99999;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 380px;
    background: #ffffff;
    border: 1px solid #bbf7d0;
    border-left: 4px solid #16a34a;
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 10px 25px -5px rgba(22, 163, 74, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
    animation: slideInRightToast 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: inherit;
}

@keyframes slideInRightToast {
    from {
        opacity: 0;
        transform: translateX(40px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.meta-connect-floating-toast.toast-fade-out {
    opacity: 0;
    transform: translateX(50px) scale(0.95);
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: none;
}

.meta-toast-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #dcfce7;
    color: #16a34a;
    display: flex;
    align-items: center;
    justify-content: center;
}

.meta-toast-body {
    flex: 1;
}

.meta-toast-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #14532d;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.meta-toast-text {
    font-size: 12px;
    color: #475569;
    line-height: 1.4;
    margin-bottom: 8px;
}

.meta-toast-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11.5px;
    font-weight: 600;
    background: #16a34a;
    color: #ffffff !important;
    padding: 5px 12px;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.15s ease;
}

.meta-toast-btn:hover {
    background: #15803d;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.3);
}

.meta-toast-close {
    background: transparent;
    border: none;
    font-size: 18px;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 2px;
    margin-left: 2px;
    transition: color 0.15s;
}

.meta-toast-close:hover {
    color: #475569;
}

/* Dark mode for Meta Floating Toast */
:root[data-theme="dark"] .meta-connect-floating-toast {
    background: #1e293b;
    border-color: #14532d;
    border-left-color: #22c55e;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

:root[data-theme="dark"] .meta-toast-icon {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

:root[data-theme="dark"] .meta-toast-title {
    color: #86efac;
}

:root[data-theme="dark"] .meta-toast-text {
    color: #94a3b8;
}

:root[data-theme="dark"] .meta-toast-close:hover {
    color: #cbd5e1;
}

/* Low Balance Variant (Amber/Gold) */
.low-balance-floating-toast {
    border-color: #fde68a;
    border-left-color: #f59e0b;
    box-shadow: 0 10px 25px -5px rgba(245, 158, 11, 0.18), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
}

.low-balance-icon {
    background: #fef3c7;
    color: #d97706;
}

.low-balance-title {
    color: #b45309;
}

.low-balance-btn {
    background: #d97706;
}

.low-balance-btn:hover {
    background: #b45309;
    box-shadow: 0 2px 6px rgba(217, 119, 6, 0.3);
}

:root[data-theme="dark"] .low-balance-floating-toast {
    border-color: #78350f;
    border-left-color: #f59e0b;
}

:root[data-theme="dark"] .low-balance-icon {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

:root[data-theme="dark"] .low-balance-title {
    color: #fde047;
}

:root[data-theme="dark"] .low-balance-btn {
    background: #f59e0b;
    color: #0f172a !important;
}

:root[data-theme="dark"] .low-balance-btn:hover {
    background: #fbbf24;
}

/* ==========================================================================
   VIO BRANDED ANIMATED LOADER & SWEEP SPINNER
   ========================================================================== */
:root {
    --vio-track: #e3f9ec;
    --vio-fill: #25d366;
    --vio-page: #f7fffa;
    --vio-ink: #16281f;
    --vio-sub: #62766c;
    --vio-backdrop-bg: rgba(247, 255, 250, 0.88);
}

:root[data-theme="dark"], [data-theme="dark"] {
    --vio-track: #145939;
    --vio-fill: #25d366;
    --vio-page: #0a3626;
    --vio-ink: #e3f9ec;
    --vio-sub: #94aa9f;
    --vio-backdrop-bg: rgba(10, 54, 38, 0.90);
}

.vio-overlay-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--vio-backdrop-bg);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.vio-overlay-backdrop.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.vio-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 24px;
    text-align: center;
}

.vio-loader {
    position: relative;
    display: inline-block;
    font-weight: 600;
    letter-spacing: 2px;
    line-height: 1;
    color: var(--vio-track);
    font-size: clamp(32px, 8vw, 48px);
    user-select: none;
}

.vio-loader::after {
    content: "VIO";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--vio-fill);
    overflow: hidden;
    width: 0;
    white-space: nowrap;
    animation: vioSweep 1.3s ease-in-out infinite;
}

@keyframes vioSweep {
    0%   { width: 0; }
    50%  { width: 100%; }
    100% { width: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .vio-loader::after {
        animation: vioFade 1.6s ease-in-out infinite;
        width: 100%;
    }
    @keyframes vioFade { 
        0%, 100% { opacity: 0.35; } 
        50% { opacity: 1; } 
    }
}

.vio-overlay p {
    margin: 0;
    font-size: clamp(13px, 3vw, 15px);
    font-weight: 500;
    color: var(--vio-sub);
    letter-spacing: 0.2px;
}



@media (min-width: 801px) {

    /* Sidebar */
    .sidebar {
        width: 244px;
        overflow-x: hidden;
        overflow-y: auto;
    }

    /* Toggle always on sidebar divider */
    .sidebar-collapse-toggle {
        position: fixed !important;
        top: 2px !important;
        left: 244px !important;
        transform: translateX(-50%) !important;

        width: 25px;
        height: 25px;

        margin: 0 !important;
        z-index: 10000;

        border-radius: 13px;
        background: var(--paper);
        border: 2px solid var(--paper);
    }

    /* =========================
       COLLAPSED SIDEBAR
       ========================= */

    :root[data-sidebar="collapsed"] .sidebar {
        width: 84px;
        padding: 24px 10px;
        overflow-x: hidden;
    }

    :root[data-sidebar="collapsed"] .main {
        margin-left: 84px;
        width: calc(100vw - 84px);
        max-width: calc(100vw - 84px);
    }

    /* Exact divider = 84px */
    :root[data-sidebar="collapsed"] .sidebar-collapse-toggle {
        left: 84px !important;
        top: 2px !important;
        transform: translateX(-50%) !important;
        margin: 0 !important;
    }

    /* Logo stays centered */
    :root[data-sidebar="collapsed"] .brand {
        width: 100%;
        justify-content: center;
        padding: 0;
        margin-bottom: 22px;
    }

    :root[data-sidebar="collapsed"] .brand-icon {
        width: 42px;
        height: 42px;
        flex: 0 0 42px;
    }

    /* Nav perfectly centered */
    :root[data-sidebar="collapsed"] .nav {
        width: 100%;
        justify-items: stretch;
    }

    :root[data-sidebar="collapsed"] .nav a {
        width: 100%;
        min-height: 42px;
        padding: 10px 0;
        justify-content: center;
        gap: 0;
    }

    :root[data-sidebar="collapsed"] .nav-icon {
        margin: 0;
    }

    /* =========================
       FOOTER
       ========================= */

    :root[data-sidebar="collapsed"] .sidebar-footer {
        width: 100%;
        margin-top: auto;
        padding-top: 14px;

        display: grid;
        justify-items: center;
        gap: 14px;

        overflow: visible;
    }

    /* Theme button */
    :root[data-sidebar="collapsed"] .sidebar-theme-toggle {
        width: 48px;
        min-width: 48px;
        height: 36px;
        padding: 5px 6px;
        margin: 0;
        justify-content: center;
    }

    /* User card */
    :root[data-sidebar="collapsed"] .user-sidebar-card {
        position: relative;

        width: 58px;
        height: 72px;
        min-height: 72px;

        padding: 10px;
        margin: 0;

        display: flex;
        align-items: flex-start;
        justify-content: center;

        border-radius: 16px;
        overflow: visible;
    }

    /* Avatar */
    :root[data-sidebar="collapsed"] .sidebar-user-avatar {
        width: 36px;
        height: 36px;
        flex: 0 0 36px;
        margin: 0;
        border-radius: 50%;
    }

    /* Logout = small badge inside card */
    :root[data-sidebar="collapsed"] .sidebar-logout {
        position: absolute;

        right: -2px;
        bottom: -2px;

        width: 26px;
        height: 26px;

        margin: 0;
        padding: 0;

        display: grid;
        place-items: center;

        border-radius: 50%;
        border: 3px solid var(--paper);

        background: var(--coral-100);
        color: var(--coral-500);

        z-index: 10;
    }

    :root[data-sidebar="collapsed"] .sidebar-logout svg {
        width: 13px;
        height: 13px;
    }
}

@media (min-width: 801px) {
    .sidebar {
        overflow-x: hidden !important;
        overflow-y: auto !important;
        scrollbar-width: none;
        -ms-overflow-style: none;
        overscroll-behavior: contain;
        border-right: 1px solid var(--sidebar-line) !important;
    }

    .sidebar::-webkit-scrollbar {
        width: 0 !important;
        height: 0 !important;
        display: none;
    }
}

@media (min-width: 801px) {
    :root[data-sidebar="collapsed"] .user-sidebar-card {
        width: 58px;
        height: 80px;
        min-height: 80px;
        padding: 10px 8px;
        position: relative;
        overflow: hidden;
        display: flex;
        justify-content: center;
        align-items: flex-start;
    }

    :root[data-sidebar="collapsed"] .sidebar-user-avatar {
        width: 36px;
        height: 36px;
        flex: 0 0 36px;
        margin: 0;
    }

    :root[data-sidebar="collapsed"] .sidebar-logout {
        position: absolute;
        left: 50%;
        right: auto;
        bottom: 7px;
        transform: translateX(-50%);

        width: 24px;
        height: 24px;
        margin: 0;
        padding: 0;

        display: grid;
        place-items: center;

        border: 0;
        border-radius: 8px;
        background: var(--coral-100);
        color: var(--coral-500);
    }

    :root[data-sidebar="collapsed"] .sidebar-logout svg {
        width: 13px;
        height: 13px;
    }
}

/* Sidebar user card states: open = one row, collapsed = centered stack */
.user-sidebar-card {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    row-gap: 10px;
}

.user-sidebar-card .sidebar-logout {
    grid-column: auto;
    justify-self: auto;
    margin-top: 0;
}

:root[data-sidebar="collapsed"] .user-sidebar-card {
    grid-template-columns: 1fr;
    row-gap: 10px;
    justify-items: center;
}

:root[data-sidebar="collapsed"] .user-sidebar-card .sidebar-logout {
    grid-column: 1 / -1;
    justify-self: center;
    margin-top: 2px;
}

:root[data-sidebar="collapsed"] .user-sidebar-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 88px;
    height: auto;
}

:root[data-sidebar="collapsed"] .user-sidebar-card .sidebar-logout {
    position: static;
    transform: none;
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    margin: 0;
}

/* ========================================================================== 
   VIO CONNECT - GLASSMORPHISM DASHBOARD DESIGN SYSTEM & ANIMATIONS
   ========================================================================== */

/* Keyframe Entrance & Micro Animations */
@keyframes glassFadeUp {
    from {
        opacity: 0;
        transform: translateY(20px) translateZ(0);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateZ(0);
    }
}

@keyframes pulseGlow {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
}

@keyframes livePulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.3); }
}

@keyframes shimmerGlow {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Base Glassmorphic Container & Shell */
.dashboard-v2-container {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: glassFadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Hero Command Banner */
.vio-hero-glass {
    position: relative;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.85) 0%, rgba(242, 250, 246, 0.95) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(226, 240, 232, 0.9);
    border-radius: 24px;
    padding: 28px 32px;
    box-shadow: 0 16px 40px rgba(6, 46, 36, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    overflow: hidden;
}

.vio-hero-glass::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.12) 0%, rgba(255, 255, 255, 0) 70%);
    pointer-events: none;
}

.vio-hero-title-group h2 {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 800;
    color: #062e24;
    letter-spacing: -0.5px;
    margin: 0 0 6px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.vio-hero-title-group p {
    font-size: 13.5px;
    color: #5c756e;
    margin: 0;
    font-weight: 500;
}

.vio-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ecfdf5;
    color: #059669;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #a7f3d0;
    letter-spacing: 0.5px;
}

.vio-hero-badge-dot {
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    animation: livePulseDot 1.5s infinite;
}

.vio-hero-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.vio-btn-glass {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.25s ease;
    cursor: pointer;
    border: 1px solid transparent;
}

.vio-btn-glass.primary {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(5, 150, 105, 0.25);
}

.vio-btn-glass.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(5, 150, 105, 0.35);
}

.vio-btn-glass.secondary {
    background: rgba(255, 255, 255, 0.8);
    color: #062e24;
    border-color: #d4e8dd;
}

.vio-btn-glass.secondary:hover {
    background: #ffffff;
    border-color: #10b981;
    color: #059669;
    transform: translateY(-2px);
}

/* Dynamic Filter Pills Bar */
.vio-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(12px);
    border: 1px solid #e2f0e8;
    border-radius: 16px;
    padding: 8px 14px;
    flex-wrap: wrap;
    gap: 12px;
}

.vio-filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.vio-filter-pill {
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    color: #5c756e;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.vio-filter-pill:hover {
    color: #062e24;
    background: rgba(16, 185, 129, 0.08);
}

.vio-filter-pill.active {
    background: #059669;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2);
}

/* Glassmorphic KPI Grid */
.vio-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
}

.vio-glass-kpi {
    position: relative;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(226, 240, 232, 0.85);
    border-radius: 18px;
    padding: 20px 22px;
    box-shadow: 0 10px 28px rgba(6, 46, 36, 0.04);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    will-change: transform;
    transform: translateZ(0);
}

.vio-glass-kpi:hover {
    transform: translateY(-4px) translateZ(0);
    box-shadow: 0 16px 36px rgba(6, 46, 36, 0.09);
    border-color: #10b981;
}

.vio-kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.vio-kpi-label {
    font-size: 12px;
    font-weight: 700;
    color: #5c756e;
    letter-spacing: 0.2px;
}

.vio-kpi-icon-box {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 14px;
}

.vio-glass-kpi.tone-blue .vio-kpi-icon-box { background: #e0f2fe; color: #0284c7; }
.vio-glass-kpi.tone-purple .vio-kpi-icon-box { background: #f3e8ff; color: #7e22ce; }
.vio-glass-kpi.tone-green .vio-kpi-icon-box { background: #ecfdf5; color: #059669; }
.vio-glass-kpi.tone-teal .vio-kpi-icon-box { background: #ccfbf1; color: #0f766e; }
.vio-glass-kpi.tone-danger .vio-kpi-icon-box { background: #fef2f2; color: #dc2626; }
.vio-glass-kpi.tone-amber .vio-kpi-icon-box { background: #fef3c7; color: #d97706; }

.vio-kpi-value {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 800;
    color: #062e24;
    line-height: 1.1;
    margin-bottom: 6px;
}

.vio-kpi-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11.5px;
    color: #718b83;
    font-weight: 600;
}

.vio-trend-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-weight: 800;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 6px;
}
.vio-trend-badge.up { background: #ecfdf5; color: #059669; }
.vio-trend-badge.down { background: #fef2f2; color: #dc2626; }

/* Grid Layout for Analytics Panels */
.vio-charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 22px;
}

@media (max-width: 1024px) {
    .vio-charts-grid {
        grid-template-columns: 1fr;
    }
}

/* Glassmorphic Chart Panel */
.vio-glass-panel {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(226, 240, 232, 0.85);
    border-radius: 22px;
    padding: 24px;
    box-shadow: 0 14px 34px rgba(6, 46, 36, 0.05);
    transition: all 0.3s ease;
}

.vio-glass-panel:hover {
    box-shadow: 0 18px 40px rgba(6, 46, 36, 0.08);
}

.vio-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.vio-panel-title-group h3 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 800;
    color: #062e24;
    margin: 0 0 4px 0;
}

.vio-panel-title-group p {
    font-size: 12.5px;
    color: #5c756e;
    margin: 0;
}

.vio-panel-chip {
    background: #ecfdf5;
    color: #059669;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #a7f3d0;
}

/* Table Styling inside Glass Panel */
.vio-glass-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.vio-glass-table th {
    font-size: 11.5px;
    font-weight: 700;
    color: #5c756e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    text-align: left;
    white-space: nowrap;
}

.vio-glass-table td {
    background: #ffffff;
    padding: 14px 16px;
    font-size: 13px;
    color: #062e24;
    font-weight: 600;
    border-top: 1px solid #e2f0e8;
    border-bottom: 1px solid #e2f0e8;
    white-space: nowrap;
    vertical-align: middle;
}

.vio-glass-table tr td:first-child {
    border-left: 1px solid #e2f0e8;
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

.vio-glass-table tr td:last-child {
    border-right: 1px solid #e2f0e8;
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

.vio-glass-table tr:hover td {
    background: #f8fdfa;
    border-color: #a7f3d0;
}

