/* =============================================
   CUSTOMER MANAGER PAGE
   ============================================= */

#customerManagerPage {
    overflow: auto;
    padding: 0;
}

#customerManagerPage.app-page {
    margin-left: auto;
    margin-right: auto;
    padding-left: 0;
    padding-right: 0;
    max-width: 1280px;
}

#customerManagerPage .customer-manager {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    max-width: 1200px;
    margin: 0 auto;
    box-sizing: border-box;
}

.customer-manager .cm-header {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 18px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.cm-header-copy h2 {
    font-size: 1.6rem;
    margin-bottom: 6px;
}

.cm-eyebrow {
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.08em;
    color: #7c8aa1;
    margin-bottom: 4px;
}

.cm-subtitle {
    color: #607087;
    max-width: 560px;
    margin: 0;
}

.cm-header-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.cm-header-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.cm-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.cm-stat-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    padding: 14px;
}

.cm-stat-card p {
    margin: 0;
    color: #5f6b7c;
    font-size: 13px;
}

.cm-stat-card strong {
    display: block;
    font-size: 1.6rem;
    margin: 6px 0 4px;
}

.cm-stat-card small {
    font-size: 12px;
    color: #9aa5b7;
}

.cm-toolbar {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    padding: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.cm-search {
    flex: 1 1 260px;
    display: flex;
    flex-direction: column;
}

.cm-search input {
    border: 1px solid #d7dce6;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
}

.cm-toolbar-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.cm-toolbar-filters label {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    color: #6c778b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cm-toolbar-filters select {
    border: 1px solid #d7dce6;
    border-radius: 10px;
    padding: 8px 12px;
    min-width: 160px;
}

.cm-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 16px;
    align-items: start;
}

.cm-table-card,
.cm-detail {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #dde3ee;
    padding: 0;
    min-height: 0;
}

.cm-table-scroll {
    max-height: 70vh;
    overflow: auto;
}

.cm-table {
    margin-bottom: 0;
    font-size: 14px;
}

.cm-table td,
.cm-table th {
    vertical-align: middle;
    border-bottom: 1px solid #eef1f6;
    padding: 12px 16px;
}

.cm-table tbody tr {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.cm-table tbody tr:hover {
    background: #f8fafc;
}

.cm-table tbody tr.cm-row-selected {
    background: #ebf3ff;
}

.cm-user {
    display: flex;
    flex-direction: column;
}

.cm-user small {
    color: #8a96ac;
}

.cm-status-chip {
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
}

.cm-status-active {
    background: rgba(17, 179, 111, 0.15);
    color: #0d8c5c;
}

.cm-status-pending {
    background: rgba(255, 193, 7, 0.2);
    color: #b26e09;
}

.cm-status-suspended {
    background: rgba(219, 53, 69, 0.2);
    color: #a01f30;
}

.cm-empty,
.cm-loading {
    padding: 24px;
    text-align: center;
}

.cm-loading {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

.cm-detail {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cm-detail[hidden] {
    display: none;
}

.cm-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.cm-detail-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.cm-detail-company {
    margin: 0;
    color: #7d889c;
}

.cm-detail-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.cm-detail-meta dt {
    font-size: 12px;
    color: #8f9bb0;
    text-transform: uppercase;
    margin: 0;
}

.cm-detail-meta dd {
    font-weight: 600;
    margin: 2px 0 0;
    overflow-wrap: anywhere;
}

.cm-detail-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cm-detail-form label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: #5c667a;
}

.cm-detail-form input,
.cm-detail-form textarea,
.cm-detail-form select {
    border: 1px solid #d7dce6;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 14px;
}

.cm-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cm-detail-feedback {
    font-size: 13px;
    margin: 0;
}

.cm-detail-feedback.cm-feedback-success {
    color: #0d8c5c;
}

.cm-detail-feedback.cm-feedback-error {
    color: #b0303c;
}

.cm-multiselect {
    border: 1px solid #e2e6ef;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cm-multiselect-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    font-size: 13px;
    color: #4b5668;
}

.cm-multiselect-header small {
    font-size: 11px;
    color: #9aa5b7;
}

.cm-token-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cm-token {
    background: #e7efff;
    color: #1a5ad7;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cm-token button {
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    padding: 0;
    font-size: 12px;
}

.cm-multiselect-search {
    position: relative;
}

.cm-multiselect-search input {
    width: 100%;
    border: 1px solid #d7dce6;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 14px;
}

.cm-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e2e6ef;
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
    list-style: none;
    margin: 0;
    padding: 4px 0;
    max-height: 220px;
    overflow-y: auto;
    z-index: 30;
}

.cm-search-results li {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
}

.cm-search-results li:hover {
    background: #f1f5ff;
}

.cm-search-results[hidden] {
    display: none;
}

.cm-add-panel-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    z-index: 1050;
    overflow-y: auto;
}

.cm-add-panel-backdrop[hidden] {
    display: none;
}

.cm-add-panel-dialog {
    background: #fff;
    border-radius: 18px;
    width: min(520px, 100%);
    padding: 24px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
}

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

.cm-add-panel-header .btn {
    padding: 0;
}

.cm-add-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cm-add-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.cm-add-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: #5c667a;
}

.cm-add-form input {
    border: 1px solid #d7dce6;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
}

.cm-add-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.cm-add-feedback {
    font-size: 13px;
    margin: 0;
}

.cm-add-feedback.cm-feedback-error {
    color: #b0303c;
}

.cm-add-feedback.cm-feedback-success {
    color: #0d8c5c;
}

.cm-table-wrapper {
    position: relative;
}

.cm-empty[hidden],
.cm-loading[hidden] {
    display: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

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

    .cm-detail {
        order: 2;
    }

    .cm-table-scroll {
        max-height: none;
    }
}

@media (max-width: 640px) {
    .customer-manager {
        padding: 12px;
    }

    .cm-header {
        padding: 16px;
    }

    .cm-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .cm-toolbar-filters {
        width: 100%;
    }

    .cm-toolbar-filters label {
        flex: 1 1 auto;
    }

    .cm-toolbar-filters select {
        width: 100%;
    }
}
