/* Connections > Ad Account list */
.adacc-page {
    --adacc-primary: #1f3fe0;
    --adacc-primary-hover: #1832bd;
    --adacc-border: #e6e9f0;
    --adacc-muted: #6b7280;
    --adacc-heading: #0f172a;
    color: var(--adacc-heading);
}

/* Breadcrumb */
.adacc-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
}

.adacc-breadcrumb a {
    color: var(--adacc-heading);
}

.adacc-breadcrumb i {
    color: var(--adacc-muted);
}

/* Page header */
.adacc-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.adacc-header > :first-child {
    flex: 1 1 20rem;
    min-width: 0;
}

.adacc-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    flex-shrink: 0;
    border-radius: 50%;
    background: #e3e9ff;
    color: var(--adacc-primary);
    font-size: 1.375rem;
}

.adacc-header-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.625rem;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.adacc-header-desc {
    margin: 0;
    font-size: 0.75rem;
    color: var(--adacc-muted);
}

.adacc-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
}

.adacc-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5625rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
}

.adacc-btn i {
    font-size: 1rem;
    line-height: 1;
}

.adacc-btn-primary {
    background: var(--adacc-primary);
    border: 1px solid var(--adacc-primary);
    color: #fff;
}

.adacc-btn-primary:hover,
.adacc-btn-primary:focus,
.adacc-btn-primary.show {
    background: var(--adacc-primary-hover);
    border-color: var(--adacc-primary-hover);
    color: #fff;
}

.adacc-btn-outline {
    background: #fff;
    border: 1px solid var(--adacc-border);
    color: var(--adacc-heading);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.adacc-btn-outline i {
    color: var(--adacc-primary);
}

.adacc-btn-outline:hover,
.adacc-btn-outline:focus,
.adacc-btn-outline.show {
    background: #f5f7ff;
    border-color: #cdd5f7;
    color: var(--adacc-heading);
}

.adacc-role-badge {
    padding: 0.125rem 0.625rem;
    border-radius: 50rem;
    background: #e3e9ff;
    color: var(--adacc-primary);
    font-size: 0.6875rem;
    font-weight: 600;
}

.adacc-btn-outline-primary {
    background: #fff;
    border: 1px solid var(--adacc-primary);
    color: var(--adacc-primary);
}

.adacc-btn-outline-primary:hover,
.adacc-btn-outline-primary:focus,
.adacc-btn-outline-primary.show {
    background: #eef1ff;
    border-color: var(--adacc-primary);
    color: var(--adacc-primary);
}

.adacc-sync-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    font-weight: 500;
}

/* Platform tabs */
.adacc-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0;
    list-style: none;
}

.adacc-tabs .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--adacc-border);
    border-radius: 50rem;
    background: #fff;
    color: var(--adacc-heading);
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
}

.adacc-tabs .nav-link:hover {
    border-color: #cdd5f7;
    background: #f5f7ff;
}

.adacc-tabs .nav-link.active {
    background: var(--adacc-primary);
    border-color: var(--adacc-primary);
    color: #fff;
}

.adacc-tabs .nav-link.active .adacc-platform {
    color: #fff;
}

/* Platform logos */
.adacc-platform {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    height: 1em;
    flex-shrink: 0;
    font-size: 1.25rem;
    line-height: 1;
}

.adacc-platform img,
.adacc-platform svg {
    width: 0.9em;
    height: 0.9em;
}

.adacc-platform-meta {
    color: #0866ff;
}

.adacc-platform-tiktok {
    color: #000;
}

.adacc-platform-all {
    color: var(--adacc-primary);
}

.adacc-platform-lg {
    font-size: 1.75rem;
}

.adacc-platform-xl {
    font-size: 2.25rem;
}

/* Platform summary cards */
.adacc-pstat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    height: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid transparent;
    border-radius: 0.75rem;
}

.adacc-pstat-meta {
    background: #eaf1ff;
    border-color: #d5e3ff;
}

.adacc-pstat-tiktok {
    background: #ffeef3;
    border-color: #ffdbe5;
}

.adacc-pstat-google {
    background: #fff7e0;
    border-color: #ffecb8;
}

.adacc-pstat-dv360 {
    background: #e8f7ee;
    border-color: #cfeedb;
}

.adacc-pstat-main {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
}

.adacc-pstat-name {
    margin: 0;
    white-space: nowrap;
    font-size: 0.8125rem;
    font-weight: 700;
}

.adacc-pstat-value {
    margin: 0;
    font-size: 1.625rem;
    font-weight: 700;
    line-height: 1.25;
}

.adacc-pstat-label {
    margin: 0;
    white-space: nowrap;
    font-size: 0.6875rem;
    color: #475569;
}

.adacc-pstat-side {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.adacc-pstat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.adacc-pstat-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.75);
    font-size: 0.8125rem;
}

.adacc-pstat-item strong {
    display: block;
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1.2;
}

.adacc-pstat-item span:not(.adacc-pstat-item-icon) {
    display: block;
    font-size: 0.6875rem;
    color: #475569;
    line-height: 1.2;
    white-space: nowrap;
}

.adacc-text-linked {
    color: #15803d;
}

.adacc-text-missing {
    color: #dc2626;
}

/* Overview panels */
/* Panels of one row share its height (the columns stretch); the panel body fills what is left
   under the title so the content can spread instead of leaving a gap at the bottom. */
.adacc-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.adacc-panel > :last-child {
    flex: 1 1 auto;
}

/* Per-platform table: rows are spread over the panel height (the missing list does the same below). */
.adacc-panel > .table-responsive > .adacc-table {
    height: 100%;
}

.adacc-panel-title {
    margin: 0 0 0.75rem;
    font-size: 0.875rem;
    font-weight: 700;
}

/* Stacked in the narrow xl column (donut above the legend), centred in the panel height.
   Side by side only when the panel is wide enough (lg, col-lg-5). The donut is sized so this
   panel is no taller than the per-platform table next to it. */
.adacc-overview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.875rem;
}

@media (min-width: 992px) and (max-width: 1199.98px) {
    .adacc-overview {
        flex-direction: row;
    }
}

.adacc-donut {
    --full: 0;
    --partial: 0;
    position: relative;
    width: min(100%, 7.5rem);
    aspect-ratio: 1;
    flex-shrink: 0;
    border-radius: 50%;
    background: conic-gradient(
            #4cb96b 0 calc(var(--full) * 1%),
            #4a8df6 0 calc((var(--full) + var(--partial)) * 1%),
            #f58a8a 0 100%
    );
}

/* Empty state (no clients yet): neutral ring instead of a full red one. */
.adacc-donut.is-empty {
    background: #eef0f4;
}

.adacc-donut-center {
    position: absolute;
    inset: 18%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fff;
    line-height: 1.2;
}

.adacc-donut-center strong {
    font-size: 1.5rem;
    font-weight: 700;
}

.adacc-donut-center span {
    font-size: 0.75rem;
    color: #475569;
}

.adacc-legend {
    display: flex;
    flex: 0 0 auto;
    align-self: stretch;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.75rem;
}

.adacc-legend li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.adacc-legend-dot {
    width: 0.625rem;
    height: 0.625rem;
    flex-shrink: 0;
    border-radius: 0.125rem;
}

.adacc-legend-full {
    background: #4cb96b;
}

.adacc-legend-partial {
    background: #4a8df6;
}

.adacc-legend-none {
    background: #f58a8a;
}

.adacc-legend-label {
    flex: 1;
}

.adacc-legend-value {
    font-weight: 600;
    white-space: nowrap;
}

.adacc-rate {
    min-width: 7rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.adacc-rate-track {
    flex: 1;
    min-width: 3.5rem;
    height: 0.375rem;
    border-radius: 50rem;
    background: #e5e9f5;
    overflow: hidden;
}

.adacc-rate-bar {
    height: 100%;
    border-radius: 50rem;
    background: var(--adacc-primary);
}

.adacc-rate .adacc-num {
    width: 2.25rem;
    text-align: right;
}

.adacc-missing-list {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.8125rem;
}

.adacc-missing-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4375rem 0;
    border-bottom: 1px solid #f0f2f6;
}

.adacc-missing-list li:last-child {
    border-bottom: 0;
}

.adacc-missing-count {
    flex: 1;
    font-weight: 600;
}

.adacc-missing-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--adacc-primary);
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: underline;
    white-space: nowrap;
}

.adacc-missing-link:hover,
.adacc-missing-link:focus-visible {
    color: var(--adacc-primary);
}

/* Filter bar */
.adacc-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.adacc-filter {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.adacc-filter label {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.adacc-filter .form-select {
    width: 8.5rem;
    height: 2.25rem;
    padding-top: 0;
    padding-bottom: 0;
    border-color: var(--adacc-border);
    border-radius: 0.5rem;
    font-size: 0.8125rem;
}

#adacc-filter-client {
    width: 9.5rem;
}

/* Filter selects are wrapped by the Choices component (components/choices.js): size the wrapper,
   leaving room for the selected label plus its remove (×) button. */
.adacc-filter .choices {
    width: 12.5rem;
    margin-bottom: 0;
    font-size: 0.8125rem;
}

.adacc-filter .choices:has(#adacc-filter-client),
.adacc-filter .choices:has(#adacc-filter-bm) {
    width: 13rem;
}

.adacc-filter .choices__list--single .choices__item {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.adacc-filter .choices__list--dropdown {
    min-width: 100%;
    width: max-content;
    max-width: 20rem;
}

.adacc-filters-end {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.adacc-filters .adacc-btn {
    height: 2.25rem;
    padding: 0 0.75rem;
}

/* List card */
.adacc-card {
    margin-bottom: 1rem;
    border-radius: 0.75rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

.adacc-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
}

.adacc-card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.adacc-search {
    position: relative;
    flex: 1 1 10rem;
    min-width: 10rem;
    max-width: 18rem;
}

.adacc-search i {
    position: absolute;
    top: 50%;
    left: 0.75rem;
    transform: translateY(-50%);
    color: var(--adacc-muted);
    font-size: 1rem;
}

.adacc-search .form-control {
    height: 2.25rem;
    padding-left: 2.25rem;
    border: 1px solid var(--adacc-border);
    border-radius: 0.5rem;
    background: #fff;
    font-size: 0.8125rem;
}

.adacc-search .form-control:focus {
    border-color: #cdd5f7;
    background: #fff;
    box-shadow: none;
}

.adacc-view-toggle {
    display: flex;
    gap: 0.25rem;
}

.adacc-view-toggle .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    color: var(--adacc-primary);
    font-size: 1.125rem;
}

.adacc-view-toggle .btn:hover,
.adacc-view-toggle .btn.active {
    border-color: #dbe1fb;
    background: #eef1ff;
}

/* Table */
.adacc-table {
    margin: 0;
    font-size: 0.8125rem;
    vertical-align: middle;
    white-space: nowrap;
}

.adacc-table > :not(caption) > * > * {
    padding: 0.625rem 0.5rem;
    border-bottom: 1px solid #f0f2f6;
}

.adacc-table > :not(caption) > * > :first-child {
    padding-left: 0.875rem;
}

.adacc-table > :not(caption) > * > :last-child {
    padding-right: 0.875rem;
}

.adacc-table thead th {
    background: #f5f6fa;
    border-bottom: 0;
    color: var(--adacc-heading);
    font-size: 0.75rem;
    font-weight: 600;
}

.adacc-table tbody tr:last-child > * {
    border-bottom: 0;
}

.adacc-table tbody tr:hover > * {
    background: #fafbff;
}

.adacc-table .form-check-input {
    margin: 0;
    cursor: pointer;
}

.adacc-table .form-check-input:checked {
    background-color: var(--adacc-primary);
    border-color: var(--adacc-primary);
}

.adacc-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.adacc-cell-title {
    margin: 0;
    font-weight: 700;
    line-height: 1.3;
}

.adacc-cell-sub {
    margin: 0;
    font-size: 0.75rem;
    color: #475569;
    line-height: 1.3;
}

.adacc-client-icon {
    color: #1d4ed8;
    font-size: 1.375rem;
    line-height: 1;
}

.adacc-num {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.adacc-status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.1875rem 0.625rem;
    border-radius: 50rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.adacc-status::before {
    content: "";
    width: 0.4375rem;
    height: 0.4375rem;
    border-radius: 50%;
    background: currentColor;
}

.adacc-status-active {
    background: #dcf5e7;
    color: #15803d;
}

.adacc-status-paused {
    background: #ffedd9;
    color: #c2620a;
}

.adacc-status-issue {
    background: #ffe1e1;
    color: #c81e1e;
}

.adacc-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.375rem;
}

.adacc-actions .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid var(--adacc-border);
    border-radius: 0.5rem;
    background: #fff;
    color: var(--adacc-heading);
    font-size: 1rem;
}

.adacc-actions .btn:hover,
.adacc-actions .btn.show {
    border-color: #cdd5f7;
    background: #f5f7ff;
    color: var(--adacc-primary);
}

.adacc-table-compact > :not(caption) > * > * {
    padding: 0.4375rem 0.625rem;
    border-bottom: 0;
}

.adacc-table-compact thead th {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    font-size: 0.6875rem;
}

.adacc-table-compact .adacc-cell {
    gap: 0.625rem;
}

.adacc-unassigned {
    display: inline-block;
    padding: 0.1875rem 0.75rem;
    border-radius: 50rem;
    background: #eef0f4;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 500;
}

.adacc-sync {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.adacc-sync i {
    color: #16a34a;
    font-size: 1rem;
    line-height: 1;
}

.adacc-pagination {
    display: flex;
    gap: 0.375rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.adacc-pagination .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.5rem;
    border: 1px solid var(--adacc-border);
    border-radius: 0.5rem;
    background: #fff;
    color: var(--adacc-heading);
    font-weight: 600;
}

.adacc-pagination .page-item.active .page-link {
    background: var(--adacc-primary);
    border-color: var(--adacc-primary);
    color: #fff;
}

.adacc-pagination .page-item.disabled .page-link {
    color: #a3a9b6;
    pointer-events: none;
}

.adacc-card .dt-container {
    position: relative;
}

.adacc-card .dt-processing {
    z-index: 2;
}

/* Platform panes without a list API yet */
.adacc-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 3rem 1rem;
    color: var(--adacc-muted);
    text-align: center;
}

.adacc-empty i {
    font-size: 2rem;
}

.adacc-empty p {
    margin: 0;
    font-size: 0.8125rem;
}

/* Detail modal */
.adacc-detail-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.adacc-detail-head h6 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.adacc-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 0.75rem 1.5rem;
    margin: 0 0 1.25rem;
    font-size: 0.8125rem;
}

.adacc-detail-grid dt {
    margin-bottom: 0.125rem;
    color: var(--adacc-muted);
    font-size: 0.75rem;
    font-weight: 500;
}

.adacc-detail-grid dd {
    margin: 0;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.adacc-detail-section-title {
    margin: 0 0 0.5rem;
    font-size: 0.875rem;
    font-weight: 700;
}

/* Unconnected clients modal */
.adacc-search-block {
    max-width: none;
}

.adacc-client-list {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.8125rem;
}

.adacc-client-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f2f6;
}

.adacc-client-list li:last-child {
    border-bottom: 0;
}

.adacc-client-list .adacc-cell {
    flex: 1;
    min-width: 0;
}

.adacc-client-list .adacc-empty {
    justify-content: center;
    border-bottom: 0;
}

@media (max-width: 575.98px) {
    .adacc-search {
        flex-basis: 100%;
        max-width: none;
    }
}
