/* Customers — tenant-facing contact list with a per-contact AI reply switch.
   Uses the theme variables so light and dark both work. Any surface that consumes
   a --*-bg variable must also consume its matching --*-fg (AGENTS.md #25). */

.customers-session-dropdown {
    min-width: 260px;
}

/* Don't let the search box stretch across the whole page. The admin toolbar grows
   it (`flex: 1 1 280px`), which leaves a huge empty input and shoves the filter
   pills to the far edge. */
#customers .admin-toolbar .search-box {
    flex: 0 1 320px;
}

/* One control height across the whole toolbar row. The dropdown trigger is 44px
   (shared `.dropdown-trigger`), but `.search-box input` is only 34px and
   `.admin-pill` 28px, so the row looked ragged next to it. The Marketing page's
   `.search-input` (12px 16px padding, 8px radius) is the existing convention for
   "search beside a dropdown" — this pins the same height explicitly. */
#customers .admin-toolbar .search-box input {
    height: 44px;
    box-sizing: border-box;
    padding: 0 16px;
    border-radius: 8px;
}

#customers .admin-toolbar .admin-pill {
    height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0 18px;
    font-size: 13px;
}

.customers-load-more-wrap {
    display: flex;
    justify-content: center;
    padding: 16px 0 8px;
}

.customers-notice {
    margin: 0 0 12px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color, #e2e8f0);
    background: var(--card-bg, #fff);
    color: var(--text-secondary, #55657a);
    font-size: 13px;
    line-height: 1.45;
}

/* Override `.admin-table { width:100%; min-width:920px }`. Four short columns
   stretched across the full content width leave big gaps between every cell, so
   the table hugs its content instead. The selector is doubled because admin.css
   loads AFTER this file and would otherwise win on equal specificity. */
.admin-table.customers-table {
    width: auto;
    min-width: 0;
}

/* Full-width table, with the spare width given to the long customer names rather
   than spread evenly across four short columns. `table-layout: fixed` is what
   makes these percentages stick. */
.admin-table.customers-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.customers-table th:nth-child(1),
.customers-table td:nth-child(1) { width: 52%; }
.customers-table th:nth-child(2),
.customers-table td:nth-child(2) { width: 20%; }
.customers-table th:nth-child(3),
.customers-table td:nth-child(3) { width: 18%; }
.customers-table th:nth-child(4),
.customers-table td:nth-child(4) { width: 10%; }

.customers-table th,
.customers-table td {
    vertical-align: middle;
}

/* Number-level AI is off: a per-contact "On" would be a lie, so this banner
   explains why no reply will be sent. */
.customers-notice-warn {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(245, 158, 11, 0.10);
    color: var(--text-primary, #111827);
}

.customers-inline-link {
    border: 0;
    background: none;
    padding: 0;
    font: inherit;
    font-weight: 600;
    color: var(--accent-primary, #2563eb);
    text-decoration: underline;
    cursor: pointer;
}

.customers-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- switch ---------- */

.customers-ai-col {
    white-space: nowrap;
}

.customers-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 40px;
    height: 22px;
    padding: 0;
    margin-right: 8px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 999px;
    background: var(--bg-primary, #f8fafc);
    cursor: pointer;
    vertical-align: middle;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.customers-toggle .customers-toggle-knob {
    display: block;
    width: 16px;
    height: 16px;
    margin-left: 2px;
    border-radius: 50%;
    background: var(--text-secondary, #55657a);
    transition: transform 0.18s ease, background 0.18s ease;
}

.customers-toggle.on {
    background: var(--accent-primary, #14160f);
    border-color: var(--accent-primary, #14160f);
}

.customers-toggle.on .customers-toggle-knob {
    transform: translateX(18px);
    background: var(--card-bg, #ffffff);
}

.customers-toggle:focus-visible {
    outline: 2px solid var(--accent-primary, #14160f);
    outline-offset: 2px;
}

.customers-toggle[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.customers-ai-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #55657a);
}

.customers-empty {
    padding: 40px 16px;
}

/* ---------- skeleton ---------- */

.customers-skeleton {
    display: grid;
    gap: 10px;
    padding: 8px 0;
}

.customers-skeleton-row {
    height: 44px;
    border-radius: 8px;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    animation: customers-pulse 1.2s ease-in-out infinite;
}

@keyframes customers-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

@media (max-width: 768px) {
    .customers-session-dropdown {
        min-width: 0;
        width: 100%;
    }
    #customers .admin-toolbar .search-box {
        flex: 1 1 100%;
    }

    /* Four columns do not fit 375px: "AI REPLY" ran into "UPDATED" and the
       On/Paused words were clipped to "Pau". Drop the least useful column and
       let the switch carry the state on its own (aria-checked still announces it). */
    .customers-table th:nth-child(4),
    .customers-table td:nth-child(4) {
        display: none;
    }

    .customers-table th,
    .customers-table td {
        padding-left: 8px;
        padding-right: 8px;
    }

    .customers-table th:nth-child(1),
    .customers-table td:nth-child(1) { width: 44%; }
    .customers-table th:nth-child(2),
    .customers-table td:nth-child(2) { width: 30%; }
    .customers-table th:nth-child(3),
    .customers-table td:nth-child(3) { width: 26%; }

    .customers-ai-label {
        display: none;
    }
    .customers-toggle {
        margin-right: 0;
    }
}
