﻿/* ConnectHub Admin UI â€” WhatsApp green palette, solid colors */
:root {
    /* Palette: #00290f | #128c7e | #39B07B | #C1E1D6 | #ece5dd */
    --ch-navy: #00290f;
    --ch-navy-2: #128c7e;
    --ch-ink: #00290f;
    --ch-muted: #5f7f76;
    --ch-line: #d5e0d4;
    --ch-surface: #ffffff;
    --ch-canvas: #ece5dd;
    --ch-coral: #39B07B; /* primary accent (actions / highlights) */
    --ch-coral-soft: #C1E1D6;
    --ch-teal: #128c7e;
    --ch-teal-soft: #C1E1D6;
    --ch-sky: #128c7e;
    --ch-sky-soft: #e8f8ef;
    --ch-amber: #4FBC7B;
    --ch-amber-soft: #fef3c7;
    --ch-rose: #e11d48;
    --ch-rose-soft: #ffe4e6;
    --ch-sidebar: 272px;
    --ch-radius: 14px;
    --ch-radius-sm: 10px;
    --ch-shadow: 0 10px 28px rgba(0, 41, 15, 0.10);
    --ch-font: "Sora", "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

/*
 * Scrollbars:
 * - vertical: invisible
 * - horizontal: thin transparent track + soft thumb (better for wide tables)
 */
* {
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: rgba(0, 41, 15, 0.22) transparent;
}

*::-webkit-scrollbar {
    width: 0; /* hide vertical */
    height: 8px; /* show horizontal */
    background: transparent;
}

*::-webkit-scrollbar:vertical {
    width: 0;
}

*::-webkit-scrollbar:horizontal {
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-track:horizontal {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: transparent;
    border: none;
}

*::-webkit-scrollbar-thumb:horizontal {
    background-color: rgba(0, 41, 15, 0.22);
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb:horizontal:hover {
    background-color: rgba(0, 41, 15, 0.38);
}

*::-webkit-scrollbar-corner {
    background: transparent;
}

.table-shell,
.table-responsive,
.dataTables_wrapper,
.dataTables_scrollBody {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 41, 15, 0.25) transparent;
}

body {
    margin: 0;
    background-color: var(--ch-canvas);
    background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='2' cy='2' r='1.2' fill='%23d5cfc6'/%3E%3C/svg%3E");
    color: var(--ch-ink);
    font-family: var(--ch-font);
    font-size: 14.5px;
    line-height: 1.5;
    overflow: auto;
}

a {
    color: var(--ch-teal);
}

.admin-shell {
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--ch-sidebar);
    background: var(--ch-navy);
    color: #e8f8ef;
    overflow: hidden;
    z-index: 1040;
    border-right: 4px solid var(--ch-coral);
    display: flex;
    flex-direction: column;
}

.admin-sidebar .sidebar-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
}

.admin-sidebar .sidebar-footer {
    flex: 0 0 auto;
    margin-top: auto;
    padding: 10px 0 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.12);
}

.admin-sidebar .sidebar-account-btn,
.admin-sidebar .sidebar-logout-btn {
    width: calc(100% - 16px);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
}

.admin-sidebar .sidebar-logout-btn:hover,
.admin-sidebar .sidebar-account-btn:hover {
    background: var(--ch-navy-2);
    color: #ffffff !important;
}

.admin-sidebar .brand-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-decoration: none;
    color: inherit;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--ch-coral);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 8px 0 rgba(0, 0, 0, 0.18);
}

.brand-copy strong {
    display: block;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
}

.brand-copy small {
    color: #a8c5bc;
    font-size: 0.75rem;
}

.sidebar-section {
    margin: 18px 14px 8px;
    padding: 0 8px;
    color: #7aa396;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

a.sidebar-link,
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 8px;
    padding: 5px 8px;
    border-radius: 10px;
    color: #C1E1D6 !important;
    text-decoration: none;
    font-weight: 600;
    border: 1px solid transparent;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

a.sidebar-link:hover,
.sidebar-link:hover {
    background: var(--ch-navy-2);
    color: #ffffff !important;
}

a.sidebar-link.active,
.sidebar-link.active {
    background: var(--ch-coral);
    color: #ffffff !important;
    border-color: #2a8a60;
    box-shadow: none;
}

.sidebar-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.92rem;
    flex-shrink: 0;
    color: inherit;
}

.sidebar-link.active .sidebar-icon {
    background: rgba(255, 255, 255, 0.22);
}

.admin-main {
    margin-left: var(--ch-sidebar);
    min-height: 100vh;
}

/* Header */
.admin-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: #fff;
    border-bottom: 1px solid var(--ch-line);
    box-shadow: 0 1px 0 #fff;
}

.admin-header .page-kicker {
    color: var(--ch-coral);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.admin-header .page-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--ch-canvas);
    border: 1px solid var(--ch-line);
    border-radius: 999px;
    padding: 6px 10px 6px 6px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--ch-teal);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* Page chrome */
.page-wrap {
    position: relative;
    min-height: 420px;
    padding: 1rem 1.15rem 1.5rem;
}

.page-card {
    background: var(--ch-surface);
    border: 1px solid var(--ch-line);
    border-radius: var(--ch-radius);
    box-shadow: var(--ch-shadow);
    overflow: hidden;
}

.page-card-accent {
    border-top: 4px solid var(--ch-coral);
}

.page-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--ch-line);
    background: #f7faf5;
}

.page-toolbar h4 {
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-toolbar p {
    margin: 0.2rem 0 0;
    color: var(--ch-muted);
    font-size: 0.9rem;
}

.page-body {
    padding: 0.9rem 1rem 1rem;
}

.filter-panel {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 0.85rem;
    background: var(--ch-canvas);
    border: 1px dashed var(--ch-line);
    border-radius: var(--ch-radius-sm);
}

.filter-panel .filter-item {
    grid-column: span 3;
}

@media (max-width: 991.98px) {
    .filter-panel .filter-item {
        grid-column: span 6;
    }
}

@media (max-width: 575.98px) {
    .filter-panel .filter-item {
        grid-column: span 12;
    }
}

/* Simple underline tabs */
.ch-tabs {
    border-bottom: 1px solid var(--ch-line);
    gap: 0.25rem;
}

.ch-tabs .nav-link {
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--ch-muted);
    font-weight: 500;
    font-size: 0.92rem;
    padding: 0.55rem 0.85rem;
    margin-bottom: -1px;
}

.ch-tabs .nav-link:hover {
    border-color: transparent;
    color: var(--ch-ink);
    background: transparent;
}

.ch-tabs .nav-link.active {
    color: var(--ch-teal);
    background: transparent;
    border-color: transparent transparent var(--ch-teal);
}

.stat-tile {
    background: #fff;
    border: 1px solid var(--ch-line);
    border-radius: var(--ch-radius);
    box-shadow: var(--ch-shadow);
    padding: 0.9rem 1rem;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.stat-tile::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: var(--tile-accent, var(--ch-coral));
}

.stat-tile .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 0.85rem;
}

.stat-tile h3 {
    font-size: 1.85rem;
    font-weight: 750;
    margin: 0 0 0.25rem;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.stat-tile p {
    margin: 0;
    color: var(--ch-muted);
    font-size: 0.9rem;
}

.dash-count-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dash-count-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem 0.75rem;
    align-items: center;
}

.dash-count-row .dash-count-label {
    font-weight: 650;
    color: var(--ch-ink, #00290f);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-count-row .dash-count-value {
    font-weight: 700;
    min-width: 2.5rem;
    text-align: right;
}

.dash-count-bar {
    grid-column: 1 / -1;
    height: 8px;
    border-radius: 999px;
    background: var(--ch-coral-soft);
    overflow: hidden;
}

.dash-count-bar > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--ch-coral);
    min-width: 0;
}

.tile-coral { --tile-accent: var(--ch-coral); }
.tile-coral .stat-icon { background: var(--ch-coral-soft); color: var(--ch-coral); }
.tile-teal { --tile-accent: var(--ch-teal); }
.tile-teal .stat-icon { background: var(--ch-teal-soft); color: var(--ch-teal); }
.tile-sky { --tile-accent: var(--ch-sky); }
.tile-sky .stat-icon { background: var(--ch-sky-soft); color: var(--ch-sky); }
.tile-amber { --tile-accent: var(--ch-amber); }
.tile-amber .stat-icon { background: var(--ch-amber-soft); color: var(--ch-amber); }

/* Buttons */
.btn {
    border-radius: 11px;
    font-weight: 650;
    letter-spacing: -0.01em;
    padding: 0.55rem 1rem;
    border-width: 1.5px;
    box-shadow: 0 3px 0 rgba(0, 41, 15, 0.10);
}

.btn-sm {
    border-radius: 9px;
    padding: 0.35rem 0.75rem;
}

.btn-primary,
.btn-success {
    --bs-btn-bg: var(--ch-coral);
    --bs-btn-border-color: var(--ch-coral);
    --bs-btn-hover-bg: #329c6d;
    --bs-btn-hover-border-color: #329c6d;
    --bs-btn-active-bg: #2a8a60;
    --bs-btn-active-border-color: #2a8a60;
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
    box-shadow: 0 4px 0 #128c7e;
}

.btn-outline-secondary {
    --bs-btn-color: var(--ch-navy);
    --bs-btn-border-color: var(--ch-line);
    --bs-btn-hover-bg: var(--ch-canvas);
    --bs-btn-hover-border-color: var(--ch-muted);
    --bs-btn-hover-color: var(--ch-navy);
}

.btn-outline-success,
.btn-outline-primary {
    --bs-btn-color: var(--ch-teal);
    --bs-btn-border-color: #a8e0b0;
    --bs-btn-hover-bg: var(--ch-teal);
    --bs-btn-hover-border-color: var(--ch-teal);
    --bs-btn-hover-color: #fff;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

/* Forms */
.form-label {
    font-weight: 650;
    color: var(--ch-navy-2);
    margin-bottom: 0.4rem;
    font-size: 0.82rem;
}

.form-control,
.form-select {
    border: 1.5px solid var(--ch-line);
    border-radius: 10px;
    background: #f7f5f1;
    min-height: 42px;
    padding: 0.5rem 0.8rem;
    color: var(--ch-ink);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.offcanvas-body .mb-3,
.offcanvas-body .mb-4 {
    margin-bottom: 0.75rem !important;
}

.offcanvas-body .mb-2 {
    margin-bottom: 0.5rem !important;
}

.form-control:focus,
.form-select:focus {
    background: #fff;
    border-color: var(--ch-coral);
    box-shadow: 0 0 0 4px rgba(57, 176, 123, 0.18);
}

.input-icon-wrap {
    position: relative;
}

.input-icon-wrap > i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ch-muted);
    z-index: 2;
    pointer-events: none;
}

.input-icon-wrap .form-control,
.input-icon-wrap .form-select {
    padding-left: 2.45rem;
}

.ch-url-upload {
    display: flex;
    align-items: stretch;
    gap: 0.45rem;
}

.ch-url-upload .input-icon-wrap {
    flex: 1 1 auto;
    min-width: 0;
}

.ch-url-upload .ch-upload-btn {
    width: 42px;
    min-width: 42px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border-width: 1.5px;
}

.ch-url-upload .ch-upload-btn i {
    font-size: 1rem;
}

.form-check-input:checked {
    background-color: var(--ch-coral);
    border-color: var(--ch-coral);
}

/* Select2 */
.select2-container--bootstrap-5 .select2-selection {
    min-height: 42px !important;
    border: 1.5px solid var(--ch-line) !important;
    border-radius: 10px !important;
    background: #f7f5f1 !important;
    padding: 0.25rem 0.5rem !important;
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: var(--ch-coral) !important;
    box-shadow: 0 0 0 4px rgba(57, 176, 123, 0.18) !important;
    background: #fff !important;
}

.select2-dropdown {
    border: 1.5px solid var(--ch-line) !important;
    border-radius: 12px !important;
    box-shadow: var(--ch-shadow) !important;
    overflow: hidden;
}

.select2-results__option--highlighted {
    background: var(--ch-coral) !important;
}

.select2-container--bootstrap-5 .select2-dropdown .select2-results__option--highlighted[aria-selected] {
    background-color: var(--ch-coral) !important;
}

/* Tables */
.table-shell {
    border: 1px solid var(--ch-line);
    border-radius: 12px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    margin-bottom: 0;
    --bs-table-bg: transparent;
    --bs-table-color: var(--ch-ink);
}

.table > thead,
table.dataTable > thead {
    --bs-table-color: #00290f;
    --bs-table-bg: #C1E1D6;
    --bs-table-border-color: #a8e0b0;
    color: #00290f;
}

.table thead th,
.table > thead > tr > th,
.table > :not(caption) > thead > * > *,
table.dataTable thead th,
table.dataTable > thead > tr > th,
.table-shell table thead th {
    background-color: #C1E1D6 !important;
    background: #C1E1D6 !important;
    color: #00290f !important;
    --bs-table-color-state: #00290f;
    --bs-table-bg-state: #C1E1D6;
    border: 0 !important;
    border-bottom: 3px solid var(--ch-coral) !important;
    font-size: 0.74rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 750;
    padding: 0.8rem 0.9rem !important;
    white-space: nowrap;
    vertical-align: middle;
}

/* Sort arrow on LEFT â€” override DataTables default `right: 12px` */
table.dataTable thead > tr > th,
table.dataTable thead > tr > td,
.table thead th {
    position: relative !important;
}

table.dataTable thead > tr > th.dt-orderable-asc,
table.dataTable thead > tr > th.dt-orderable-desc,
table.dataTable thead > tr > th.dt-ordering-asc,
table.dataTable thead > tr > th.dt-ordering-desc,
table.dataTable thead > tr > th.dt-orderable-none {
    padding-left: 1.85rem !important;
    padding-right: 0.75rem !important;
}

table.dataTable thead > tr > th div.dt-column-header,
.table thead th div.dt-column-header {
    display: flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
    position: static !important;
    width: 100%;
    min-height: 1.15rem;
}

table.dataTable thead .dt-column-title,
.table thead .dt-column-title {
    display: inline-block;
    color: #00290f !important;
    line-height: 1.2;
    padding: 0 !important;
    margin: 0 !important;
}

table.dataTable thead > tr > th.dt-orderable-asc span.dt-column-order,
table.dataTable thead > tr > th.dt-orderable-desc span.dt-column-order,
table.dataTable thead > tr > th.dt-ordering-asc span.dt-column-order,
table.dataTable thead > tr > th.dt-ordering-desc span.dt-column-order,
table.dataTable thead > tr > th span.dt-column-order,
table.dataTable thead span.dt-column-order,
.table thead .dt-column-order {
    position: absolute !important;
    left: 0.5rem !important;
    right: auto !important;
    top: 50% !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
    width: 12px !important;
    height: 16px !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    opacity: 0.85;
    z-index: 3;
}

table.dataTable thead th *,
.table thead th * {
    color: #00290f !important;
}

table.dataTable thead .dt-column-order:before,
table.dataTable thead .dt-column-order:after,
.table thead .dt-column-order:before,
.table thead .dt-column-order:after {
    color: #39B07B !important;
    opacity: 0.85 !important;
}

table.dataTable thead th.dt-ordering-asc .dt-column-order:before,
table.dataTable thead th.dt-ordering-desc .dt-column-order:after {
    opacity: 1 !important;
    color: #128c7e !important;
}

.table tbody td,
table.dataTable tbody td {
    padding: 0.65rem 0.75rem !important;
    vertical-align: middle;
    border-color: #e4ebe3;
    color: var(--ch-ink);
}

.table-hover > tbody > tr:hover > * {
    --bs-table-bg-state: #f3fce9;
}

/* Action dropdown */
.btn-action-dropdown {
    --bs-btn-color: #ffffff;
    --bs-btn-bg: #00290f;
    --bs-btn-border-color: #00290f;
    --bs-btn-hover-color: #ffffff;
    --bs-btn-hover-bg: #128c7e;
    --bs-btn-hover-border-color: #128c7e;
    --bs-btn-active-color: #ffffff;
    --bs-btn-active-bg: #001a0a;
    --bs-btn-active-border-color: #001a0a;
    --bs-btn-disabled-color: #ffffff;
    --bs-btn-disabled-bg: #00290f;
    --bs-btn-disabled-border-color: #00290f;
    color: #ffffff !important;
    background-color: #00290f !important;
    border-color: #00290f !important;
    box-shadow: none;
    font-weight: 650;
    padding: 0.3rem 0.7rem;
}

.btn-action-dropdown:hover,
.btn-action-dropdown:focus,
.btn-action-dropdown:focus-visible,
.btn-action-dropdown:active,
.btn-action-dropdown.active,
.btn-action-dropdown.show,
.btn-check:checked + .btn-action-dropdown,
.btn-action-dropdown:first-child:active,
:not(.btn-check) + .btn-action-dropdown:active {
    color: #ffffff !important;
    background-color: #128c7e !important;
    border-color: #128c7e !important;
    box-shadow: none !important;
}

.btn-action-dropdown i,
.btn-action-dropdown:hover i,
.btn-action-dropdown.show i,
.btn-action-dropdown.active i,
.btn-action-dropdown:active i {
    color: #ffffff !important;
}

.ch-action-dropdown .dropdown-menu {
    border: 1px solid var(--ch-line);
    border-radius: 10px;
    padding: 0.35rem;
    min-width: 10.5rem;
}

.ch-action-dropdown .dropdown-item {
    border-radius: 8px;
    font-weight: 600;
    padding: 0.45rem 0.7rem;
    display: flex;
    align-items: center;
}

.ch-action-dropdown .dropdown-item i {
    width: 1.1rem;
    text-align: center;
}

/* Direct icon actions */
.ch-icon-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.btn-icon-action {
    width: 2rem;
    height: 2rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.95rem;
}

.btn-icon-action-success {
    color: #fff !important;
    background: #39B07B !important;
    border-color: #39B07B !important;
}

.btn-icon-action-success:hover {
    background: #2a8a60 !important;
    border-color: #2a8a60 !important;
}

.btn-icon-action-warning {
    color: #fff !important;
    background: #4FBC7B !important;
    border-color: #4FBC7B !important;
}

.btn-icon-action-warning:hover {
    background: #b45309 !important;
    border-color: #b45309 !important;
}

.btn-icon-action-danger {
    color: #fff !important;
    background: #dc2626 !important;
    border-color: #dc2626 !important;
}

.btn-icon-action-danger:hover {
    background: #b91c1c !important;
    border-color: #b91c1c !important;
}

.btn-icon-action-neutral {
    color: #fff !important;
    background: #00290f !important;
    border-color: #00290f !important;
}

.btn-icon-action-neutral:hover {
    background: #128c7e !important;
    border-color: #128c7e !important;
}

/* Badges */
.badge {
    border-radius: 999px;
    font-weight: 650;
    letter-spacing: 0.02em;
    padding: 0.4em 0.75em;
}

.badge.text-bg-success,
.bg-success {
    background: var(--ch-teal) !important;
}

.badge.text-bg-danger,
.bg-danger {
    background: var(--ch-rose) !important;
}

.badge.text-bg-warning {
    background: var(--ch-amber) !important;
    color: #fff !important;
}

.badge.text-bg-secondary {
    background: var(--ch-navy-2) !important;
}

/* Offcanvas */
.offcanvas {
    border-left: 4px solid var(--ch-coral);
    width: min(529px, 100vw) !important; /* ~15% wider than 460px */
}

/* Wide offcanvas for detail drill-downs */
.offcanvas.wide-detail-offcanvas {
    width: 60vw !important;
    max-width: 60vw;
}

.offcanvas.import-errors-offcanvas {
    width: 40vw !important;
    max-width: 40vw;
}

.offcanvas.campaign-messages-offcanvas {
    width: 70vw !important;
    max-width: 70vw;
}

.offcanvas-header {
    background: var(--ch-navy);
    color: #fff;
    padding: 0.85rem 1rem;
}

.offcanvas-title {
    font-weight: 700;
    letter-spacing: -0.02em;
    font-size: 1rem;
}

.offcanvas-header .btn-close {
    filter: invert(1);
    opacity: 0.85;
}

.offcanvas-body {
    background: #f7faf5;
    padding: 0.9rem 1rem 0;
    display: flex;
    flex-direction: column;
}

.offcanvas-body > form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.offcanvas-footer-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin: 0.75rem -1rem 0;
    padding: 0.75rem 1rem 1rem;
    background: #fff;
    border-top: 1px solid var(--ch-line);
    box-shadow: 0 -6px 16px rgba(0, 41, 15, 0.06);
}

.offcanvas-body .border.rounded-3 {
    padding: 0.65rem 0.75rem !important;
    margin-bottom: 0.65rem !important;
}

.form-section-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0.15rem 0 0.65rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--ch-coral-soft);
    color: var(--ch-navy);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-section-title i {
    color: var(--ch-coral);
}

/* Alerts */
.alert {
    border-radius: 12px;
    border-width: 0 0 0 4px;
    border-style: solid;
}

.alert-success { border-left-color: var(--ch-teal); background: var(--ch-teal-soft); }
.alert-warning { border-left-color: var(--ch-amber); background: var(--ch-amber-soft); }
.alert-danger { border-left-color: var(--ch-rose); background: var(--ch-rose-soft); }

/* DataTables */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border: 1.5px solid var(--ch-line);
    border-radius: 10px;
    background: #f7f5f1;
    min-height: 40px;
    padding: 0.35rem 0.65rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover,
.dataTables_wrapper .pagination .page-item.active .page-link,
.pagination .page-item.active .page-link {
    background-color: #00290f !important;
    border-color: #00290f !important;
    color: #ffffff !important;
}

.dataTables_wrapper .pagination .page-link {
    color: #00290f;
}

.dataTables_wrapper .pagination .page-link:hover {
    color: #00290f;
    background-color: #C1E1D6;
    border-color: #d5e0d4;
}

/* Login */
.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    background: var(--ch-canvas);
}

.login-aside {
    background: var(--ch-navy);
    color: #fff;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-right: 6px solid var(--ch-coral);
}

.login-aside h1 {
    font-size: clamp(2rem, 3vw, 2.8rem);
    font-weight: 750;
    letter-spacing: -0.04em;
    line-height: 1.1;
    margin: 1rem 0 0.75rem;
}

.login-aside p {
    color: #a8c5bc;
    max-width: 28rem;
    font-size: 1.02rem;
}

.login-feature {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-top: 1.1rem;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
}

.login-feature i {
    color: var(--ch-coral);
    font-size: 1.2rem;
    margin-top: 2px;
}

.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-panel-inner {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.login-card {
    width: 100%;
    background: #fff;
    border: 1px solid var(--ch-line);
    border-radius: 18px;
    box-shadow: var(--ch-shadow);
    padding: 2rem;
    border-top: 5px solid var(--ch-coral);
}

.login-forgot-link {
    font-size: 0.875rem;
    color: var(--ch-coral);
    text-decoration: none;
    box-shadow: none;
    background: none;
    border: 0;
    padding: 0;
}

.login-forgot-link:hover {
    color: var(--ch-navy);
    text-decoration: underline;
}

.login-branding {
    text-align: center;
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--ch-muted);
}

.login-branding a {
    color: var(--ch-coral);
    font-weight: 650;
    text-decoration: none;
}

.login-branding a:hover {
    color: var(--ch-teal);
    text-decoration: underline;
}

/* Kill browser autofill blue on login fields — keep green theme */
.login-card .form-control,
.login-card .form-control:focus {
    background-color: #f3faf6 !important;
    border-color: #b7d9c8;
    color: var(--ch-ink);
    caret-color: var(--ch-navy);
}

.login-card .form-control:focus {
    background-color: #fff !important;
    border-color: var(--ch-coral) !important;
    box-shadow: 0 0 0 4px rgba(57, 176, 123, 0.18) !important;
}

.login-card .form-control:-webkit-autofill,
.login-card .form-control:-webkit-autofill:hover,
.login-card .form-control:-webkit-autofill:focus,
.login-card .form-control:-webkit-autofill:active {
    -webkit-text-fill-color: var(--ch-ink) !important;
    caret-color: var(--ch-navy);
    box-shadow: 0 0 0 1000px #e8f8ef inset !important;
    -webkit-box-shadow: 0 0 0 1000px #e8f8ef inset !important;
    border-color: var(--ch-coral) !important;
    transition: background-color 99999s ease-out;
}

.login-card .input-icon-wrap > i {
    color: var(--ch-teal);
}

.login-card .form-check-input:focus {
    border-color: var(--ch-coral);
    box-shadow: 0 0 0 4px rgba(57, 176, 123, 0.18);
}

.login-card .form-check-input:checked {
    background-color: var(--ch-coral);
    border-color: var(--ch-coral);
}

@media (max-width: 991.98px) {
    .admin-sidebar {
        position: static;
        width: 100%;
        border-right: 0;
        border-bottom: 4px solid var(--ch-coral);
    }

    .admin-main {
        margin-left: 0;
    }

    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-aside {
        border-right: 0;
        border-bottom: 6px solid var(--ch-coral);
        padding: 2rem;
    }
}

/* Loading spinner — WhatsApp green shades only */
.ch-wa-spinner,
.spinner-border.ch-wa-spinner {
    width: 2.35rem;
    height: 2.35rem;
    color: #25D366 !important;
    border-width: 0.28em;
    border-right-color: #25D366 !important;
    border-top-color: #25D366 !important;
    border-bottom-color: rgba(18, 140, 126, 0.28) !important;
    border-left-color: rgba(7, 94, 84, 0.22) !important;
}

/* Hide DataTables built-in loader — app uses skeleton / WhatsApp-green overlay */
.dataTables_wrapper .dataTables_processing,
div.dataTables_processing {
    display: none !important;
    visibility: hidden !important;
}

/* ---------- Page / AJAX skeleton loading ---------- */
@keyframes ch-skel-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.ch-skel {
    display: block;
    border-radius: 10px;
    background: linear-gradient(
        90deg,
        #dcefe4 0%,
        #f3faf6 45%,
        #dcefe4 90%
    );
    background-size: 200% 100%;
    animation: ch-skel-shimmer 1.15s ease-in-out infinite;
}

.ch-page-skeleton {
    position: absolute;
    inset: 0;
    z-index: 30;
    padding: 0;
    background: transparent;
    transition: opacity 0.28s ease, visibility 0.28s ease;
}

.ch-page-content {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.28s ease, transform 0.28s ease;
    pointer-events: none;
}

body.ch-page-loading .ch-page-skeleton {
    opacity: 1;
    visibility: visible;
}

body.ch-ready .ch-page-skeleton {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

body.ch-ready .ch-page-content {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.ch-skel-card {
    background: #fff;
    border: 1px solid var(--ch-line);
    border-radius: var(--ch-radius);
    box-shadow: var(--ch-shadow);
    border-top: 4px solid var(--ch-coral);
    padding: 1.15rem 1.2rem 1.35rem;
}

.ch-skel-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.15rem;
}

.ch-skel-title {
    width: min(280px, 55vw);
    height: 22px;
    margin-bottom: 0.55rem;
}

.ch-skel-line {
    height: 12px;
    width: min(360px, 70vw);
}

.ch-skel-line.short {
    width: min(220px, 48vw);
}

.ch-skel-actions {
    display: flex;
    gap: 0.55rem;
    flex-shrink: 0;
}

.ch-skel-btn {
    width: 108px;
    height: 38px;
    border-radius: 11px;
}

.ch-skel-tiles {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.15rem;
}

.ch-skel-tile {
    height: 96px;
    border-radius: 12px;
}

.ch-skel-filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.1rem;
}

.ch-skel-field {
    height: 42px;
    border-radius: 11px;
}

.ch-skel-table {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.ch-skel-row {
    height: 18px;
    width: 100%;
}

.ch-skel-row.head {
    height: 14px;
    width: 92%;
    opacity: 0.85;
}

.ch-skel-row:nth-child(3),
.ch-skel-row:nth-child(5),
.ch-skel-row:nth-child(7) {
    width: 96%;
}

.ch-skel-row:nth-child(4),
.ch-skel-row:nth-child(6) {
    width: 88%;
}

/* Green spinner used by blockUI for AJAX. No card. */
.ch-ajax-loader {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
    line-height: 0;
}

.ch-spinner {
    display: block;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 4px solid rgba(57, 176, 123, 0.28);
    border-top-color: #39B07B;
    animation: ch-spin 0.7s linear infinite;
}

@keyframes ch-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 991.98px) {
    .ch-skel-tiles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ch-skel-filters {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575.98px) {
    .ch-skel-toolbar {
        flex-direction: column;
    }

    .ch-skel-tiles {
        grid-template-columns: 1fr;
    }

    .ch-skel-actions {
        width: 100%;
    }

    .ch-skel-btn {
        flex: 1;
    }
}

/* Campaign / Reports progress bars */
.campaign-progress .progress {
    background-color: #dcefe4;
    border-radius: 999px;
    overflow: hidden;
}

.campaign-progress .progress-bar.bg-primary {
    background-color: #3b82f6 !important;
}

.campaign-progress .progress-bar.bg-success {
    background-color: #39B07B !important;
}

.campaign-progress .progress-bar.bg-warning {
    background-color: #f59e0b !important;
}

.campaign-progress .progress-bar.bg-danger {
    background-color: #dc3545 !important;
}

.campaign-progress .text-danger {
    color: #dc3545 !important;
}

/* Status switch (Active / Inactive) */
.ch-status-switch {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 42px;
    padding: 0.35rem 0.75rem;
    border: 1.5px solid var(--ch-line);
    border-radius: 10px;
    background: #f7f5f1;
}

.ch-status-switch .form-check-input {
    width: 2.6rem;
    height: 1.35rem;
    margin: 0;
    cursor: pointer;
    background-color: #9fb3a8;
    border-color: #9fb3a8;
}

.ch-status-switch .form-check-input:focus {
    box-shadow: 0 0 0 4px rgba(57, 176, 123, 0.18);
    border-color: #39B07B;
}

.ch-status-switch .form-check-input:checked {
    background-color: #39B07B;
    border-color: #39B07B;
}

.ch-status-switch .form-check-label {
    margin: 0;
    font-weight: 650;
    color: var(--ch-ink);
    cursor: pointer;
}

.ch-status-switch .ch-status-label.is-inactive {
    color: var(--ch-muted);
}

/* SweetAlert2 — ConnectHub green palette */
.swal2-styled.swal2-confirm {
    background-color: var(--ch-coral) !important;
    border-color: var(--ch-coral) !important;
    box-shadow: none !important;
}

.swal2-styled.swal2-confirm:focus {
    box-shadow: 0 0 0 3px rgba(57, 176, 123, 0.35) !important;
}

.swal2-styled.swal2-cancel {
    background-color: var(--ch-navy) !important;
    border-color: var(--ch-navy) !important;
    box-shadow: none !important;
}

.swal2-styled.swal2-cancel:focus {
    box-shadow: 0 0 0 3px rgba(0, 41, 15, 0.25) !important;
}

.swal2-actions {
    gap: 0.5rem;
}

.ch-template-preview {
    background: var(--ch-sky-soft);
    border: 1px solid var(--ch-line);
    border-radius: var(--ch-radius-sm);
    color: var(--ch-ink);
    font-size: 0.95rem;
    line-height: 1.55;
    padding: 0.85rem 1rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ===== Help / User Manual ===== */
/* page-card uses overflow:hidden; that breaks position:sticky for the TOC */
.help-shell.page-card {
    overflow: visible;
}

.help-shell .page-body {
    padding-top: 0.25rem;
    overflow: visible;
}

.help-layout {
    display: grid;
    grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.help-nav {
    position: sticky;
    top: 5.25rem; /* sit below sticky admin header */
    z-index: 20;
    align-self: start;
    max-height: calc(100vh - 6rem);
    overflow: auto;
    background: var(--ch-sky-soft);
    border: 1px solid var(--ch-line);
    border-radius: var(--ch-radius-sm);
    padding: 0.85rem;
}

.help-search-wrap {
    position: relative;
    margin-bottom: 0.65rem;
}

.help-search-wrap > i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ch-muted);
    pointer-events: none;
}

.help-search-wrap .form-control {
    padding-left: 2.15rem;
    border-radius: 999px;
    border-color: var(--ch-line);
    background: #fff;
}

.help-search-wrap .form-control:focus {
    border-color: var(--ch-coral);
    box-shadow: 0 0 0 3px rgba(57, 176, 123, 0.2);
}

.help-search-meta {
    font-size: 0.78rem;
    color: var(--ch-muted);
    margin-bottom: 0.55rem;
    padding: 0 0.15rem;
}

.help-toc {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.help-toc-link {
    display: block;
    padding: 0.45rem 0.7rem;
    border-radius: 8px;
    color: var(--ch-ink);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.help-toc-link:hover {
    background: rgba(18, 140, 126, 0.12);
    color: var(--ch-teal);
}

.help-toc-link.active {
    background: var(--ch-teal);
    color: #fff;
}

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

.help-section {
    border: 1px solid var(--ch-line);
    border-radius: var(--ch-radius-sm);
    background: #fff;
    padding: 1.15rem 1.25rem 1.25rem;
    margin-bottom: 1rem;
    scroll-margin-top: 1rem;
}

.help-section-hit {
    box-shadow: 0 0 0 2px rgba(57, 176, 123, 0.25);
}

.help-section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ch-navy);
    margin: 0 0 0.65rem;
}

.help-section h3 i {
    color: var(--ch-coral);
}

.help-section h5 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ch-navy-2);
    margin: 1rem 0 0.45rem;
}

.help-section p,
.help-section li {
    color: var(--ch-ink);
    font-size: 0.93rem;
    line-height: 1.6;
}

.help-section ul,
.help-section ol {
    padding-left: 1.2rem;
    margin-bottom: 0.55rem;
}

.help-section code {
    background: var(--ch-sky-soft);
    border: 1px solid var(--ch-line);
    border-radius: 6px;
    padding: 0.05rem 0.35rem;
    font-size: 0.85em;
}

.help-callout {
    margin-top: 0.85rem;
    padding: 0.75rem 0.9rem;
    border-radius: var(--ch-radius-sm);
    background: #fff8e8;
    border: 1px solid #f1dfb0;
    color: #6b5420;
    font-size: 0.9rem;
    line-height: 1.5;
}

.help-steps {
    counter-reset: help-step;
    list-style: none;
    padding-left: 0;
}

.help-steps li {
    counter-increment: help-step;
    position: relative;
    padding: 0.55rem 0.75rem 0.55rem 2.6rem;
    margin-bottom: 0.4rem;
    border: 1px solid var(--ch-line);
    border-radius: 10px;
    background: var(--ch-sky-soft);
}

.help-steps li::before {
    content: counter(help-step);
    position: absolute;
    left: 0.7rem;
    top: 0.55rem;
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 50%;
    background: var(--ch-teal);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.help-faq-item {
    border-top: 1px solid var(--ch-line);
    padding: 0.75rem 0;
}

.help-faq-item:first-child {
    border-top: 0;
    padding-top: 0.15rem;
}

.help-faq-item strong {
    display: block;
    color: var(--ch-navy);
    margin-bottom: 0.25rem;
}

.help-faq-item p {
    margin: 0;
    color: var(--ch-muted);
}

.help-no-results {
    padding: 1.25rem;
    border: 1px dashed var(--ch-line);
    border-radius: var(--ch-radius-sm);
    color: var(--ch-muted);
    text-align: center;
    background: #fff;
}

mark.help-mark {
    background: #ffe08a;
    color: inherit;
    padding: 0 0.1em;
    border-radius: 3px;
}

@media (max-width: 991.98px) {
    .help-layout {
        grid-template-columns: 1fr;
    }

    .help-nav {
        position: static;
        max-height: none;
        overflow: visible;
    }

    .help-toc {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.35rem;
    }
}

@media (max-width: 575.98px) {
    .help-toc {
        grid-template-columns: 1fr;
    }
}
