/* ============================================================
   Customer Portal Manager – Frontend Styles
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
    --cpm-primary:        #1e40af;
    --cpm-primary-light:  #dbeafe;
    --cpm-primary-hover:  #1e3a8a;
    --cpm-success:        #15803d;
    --cpm-success-light:  #dcfce7;
    --cpm-warning:        #b45309;
    --cpm-warning-light:  #fef3c7;
    --cpm-danger:         #b91c1c;
    --cpm-danger-light:   #fee2e2;
    --cpm-info:           #0369a1;
    --cpm-info-light:     #e0f2fe;
    --cpm-text:           #1f2937;
    --cpm-text-secondary: #6b7280;
    --cpm-text-muted:     #9ca3af;
    --cpm-border:         #e5e7eb;
    --cpm-border-hover:   #d1d5db;
    --cpm-bg:             #ffffff;
    --cpm-bg-subtle:      #f9fafb;
    --cpm-bg-muted:       #f3f4f6;
    --cpm-radius:         8px;
    --cpm-radius-sm:      4px;
    --cpm-shadow-sm:      0 1px 2px rgba(0,0,0,.05);
    --cpm-shadow:         0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --cpm-shadow-md:      0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
    --cpm-transition:     0.15s ease;
}

/* ── Base ──────────────────────────────────────────────────── */
.cpm-portal {
    max-width: 1000px;
    font-family: inherit;
    color: var(--cpm-text);
    line-height: 1.5;
    padding-bottom: 4rem;
    margin-bottom: 4rem;
}
.cpm-portal *, .cpm-portal *::before, .cpm-portal *::after { box-sizing: border-box; }

/* ── Status bar ────────────────────────────────────────────── */
.cpm-status-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    background: var(--cpm-bg);
    border: 1px solid var(--cpm-border);
    border-radius: var(--cpm-radius);
    overflow: hidden;
    margin-bottom: 1rem;
    box-shadow: var(--cpm-shadow-sm);
}
.cpm-status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 20px;
    flex: 1 1 0;
    min-width: 100px;
    text-align: center;
    border-right: 1px solid var(--cpm-border);
}
.cpm-status-item:last-child { border-right: none; }
.cpm-status-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--cpm-text-muted);
}
.cpm-status-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--cpm-text);
}
.cpm-status-value--primary { font-size: 16px; color: var(--cpm-primary); }
.cpm-status-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 99px;
    white-space: nowrap;
}
.cpm-status-badge--ok      { background: var(--cpm-success-light); color: var(--cpm-success); }
.cpm-status-badge--warn    { background: var(--cpm-warning-light); color: var(--cpm-warning); }
.cpm-status-badge--pending { background: var(--cpm-info-light);    color: var(--cpm-info); }
.cpm-status-badge--neutral { background: var(--cpm-bg-muted);      color: var(--cpm-text-muted); }

/* ── Alerts ────────────────────────────────────────────────── */
.cpm-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--cpm-radius);
    margin-bottom: 1rem;
    font-size: 14px;
}
.cpm-alert-icon { flex-shrink: 0; font-size: 16px; line-height: 1.4; width: 22px; text-align: center; }
.cpm-alert-body { flex: 1; }
.cpm-alert--warning { background: var(--cpm-warning-light); border: 1px solid #fde68a; color: var(--cpm-warning); }
.cpm-alert--success { background: var(--cpm-success-light); border: 1px solid #bbf7d0; color: var(--cpm-success); }
.cpm-alert--info    { background: var(--cpm-info-light);    border: 1px solid #bae6fd; color: var(--cpm-info); }

/* ── Tabs ──────────────────────────────────────────────────── */
.cpm-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-bottom: 2px solid var(--cpm-border);
    margin-bottom: 0;
    background: var(--cpm-bg-subtle, #f9fafb);
    border-radius: var(--cpm-radius) var(--cpm-radius) 0 0;
}
.cpm-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1 1 auto;
    padding: 14px 16px 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--cpm-text-secondary);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    cursor: pointer;
    border-radius: var(--cpm-radius) var(--cpm-radius) 0 0;
    transition: color var(--cpm-transition), border-color var(--cpm-transition), background var(--cpm-transition);
}
.cpm-tab:hover { color: var(--cpm-text); background: var(--cpm-bg-muted, #f3f4f6); text-decoration: none; }
.cpm-tab--active { color: var(--cpm-primary); border-bottom-color: var(--cpm-primary); font-weight: 600; background: var(--cpm-bg); }
.cpm-tab--active:hover { color: var(--cpm-primary); }
.cpm-tab-icon { display: flex; align-items: center; flex-shrink: 0; }
.cpm-tab-icon svg { display: block; width: 22px; height: 22px; }
.cpm-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 700;
    background: var(--cpm-bg-muted);
    color: var(--cpm-text-secondary);
    border-radius: 99px;
}
.cpm-tab--active .cpm-tab-count { background: var(--cpm-primary-light); color: var(--cpm-primary); }
.cpm-tab-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cpm-warning); flex-shrink: 0; }

/* ── Tab panels ────────────────────────────────────────────── */
.cpm-tab-panels { padding-top: 1.5rem; }
.cpm-tab-panel { display: none; }
.cpm-tab-panel--active { display: block; animation: cpmFadeIn .2s ease; }
@keyframes cpmFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ── Cards ─────────────────────────────────────────────────── */
.cpm-card {
    background: var(--cpm-bg);
    border: 1px solid var(--cpm-border);
    border-top: 3px solid var(--cpm-primary);
    border-radius: var(--cpm-radius);
    box-shadow: var(--cpm-shadow-sm);
    overflow: hidden;
}
.cpm-card + .cpm-card:not(.cpm-card-grid > *) { margin-top: 1rem; }
.cpm-card-grid > .cpm-card + .cpm-card { margin-top: 0; }
.cpm-card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--cpm-border);
    background: var(--cpm-bg-subtle);
}
.cpm-card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--cpm-text);
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.4;
}
.cpm-card-title svg { flex-shrink: 0; color: var(--cpm-text-secondary); }
.cpm-card-body { padding: 20px; }
.cpm-card-body--flush { padding: 0; }
.cpm-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    align-items: start;
}

/* ── Data list ─────────────────────────────────────────────── */
.cpm-data-list { margin: 0; padding: 0; }
.cpm-data-row {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--cpm-border);
}
.cpm-data-row:last-child { border-bottom: none; padding-bottom: 0; }
.cpm-data-row:first-child { padding-top: 0; }
.cpm-data-row dt { flex: 0 0 120px; font-size: 13px; font-weight: 500; color: var(--cpm-text-secondary); padding-top: 1px; }
.cpm-data-row dd { flex: 1; margin: 0; font-size: 14px; color: var(--cpm-text); line-height: 1.5; }

/* ── Contact cards ─────────────────────────────────────────── */
.cpm-contacts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.cpm-contact-card {
    background: var(--cpm-bg);
    border: 1px solid var(--cpm-border);
    border-radius: var(--cpm-radius);
    overflow: hidden;
    box-shadow: var(--cpm-shadow-sm);
    transition: box-shadow var(--cpm-transition), border-color var(--cpm-transition);
}
.cpm-contact-card:hover { box-shadow: var(--cpm-shadow-md); border-color: var(--cpm-border-hover); }
.cpm-contact-card--default { border-color: var(--cpm-primary); border-width: 1px 1px 1px 3px; }
.cpm-contact-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--cpm-bg-subtle);
    border-bottom: 1px solid var(--cpm-border);
}
.cpm-contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--cpm-primary-light);
    color: var(--cpm-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}
.cpm-contact-meta { flex: 1; min-width: 0; }
.cpm-contact-name { display: block; font-size: 15px; font-weight: 600; color: var(--cpm-text); margin-bottom: 4px; }
.cpm-contact-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.cpm-contact-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.cpm-contact-detail {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: var(--cpm-text-secondary);
    line-height: 1.4;
}
.cpm-contact-detail svg { flex-shrink: 0; margin-top: 1px; color: var(--cpm-text-muted); }
.cpm-contact-detail a { color: var(--cpm-primary); text-decoration: none; }
.cpm-contact-detail a:hover { text-decoration: underline; }

/* ── Badges ────────────────────────────────────────────────── */
.cpm-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 99px;
    white-space: nowrap;
    line-height: 1.5;
}
.cpm-badge--primary { background: var(--cpm-primary);  color: #fff; }
.cpm-badge--subtle  { background: var(--cpm-bg-muted); color: var(--cpm-text-secondary); border: 1px solid var(--cpm-border); }

/* ── Quick actions ─────────────────────────────────────────── */
.cpm-quick-actions { margin-top: 1.5rem; }
.cpm-section-title {
    margin: 0 0 .75rem;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--cpm-text-muted);
}
h4.cpm-section-title.cpm-section-title--danger {
    color: var(--cpm-danger, #b91c1c) !important;
}
.cpm-action-cards { display: flex; flex-direction: column; gap: 8px; }
.cpm-action-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--cpm-bg);
    border: 1px solid var(--cpm-border);
    border-left: 3px solid var(--cpm-danger);
    border-radius: var(--cpm-radius);
    text-decoration: none;
    color: var(--cpm-text);
    box-shadow: var(--cpm-shadow-sm);
    cursor: pointer;
    transition: box-shadow var(--cpm-transition), border-right-color var(--cpm-transition), border-bottom-color var(--cpm-transition), border-top-color var(--cpm-transition);
}
.cpm-action-card:hover { box-shadow: var(--cpm-shadow-md); border-right-color: var(--cpm-border-hover); border-bottom-color: var(--cpm-border-hover); border-top-color: var(--cpm-border-hover); text-decoration: none; }
.cpm-action-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--cpm-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.cpm-action-icon--warn    { background: var(--cpm-warning-light); color: var(--cpm-warning); }
.cpm-action-icon--pending { background: var(--cpm-info-light);    color: var(--cpm-info); }

/* Accent line follows action status – darker shade of danger */
.cpm-action-card--warn    { border-left-color: #7f1d1d; }
.cpm-action-card--pending { border-left-color: #991b1b; }
.cpm-action-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.cpm-action-text strong { font-size: 14px; font-weight: 600; color: var(--cpm-text); }
.cpm-action-text small   { font-size: 12px; color: var(--cpm-text-secondary); }
.cpm-action-arrow { font-size: 18px; color: var(--cpm-text-muted); flex-shrink: 0; }

/* ── Mini table ────────────────────────────────────────────── */
.cpm-mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cpm-mini-table thead th {
    background: var(--cpm-bg-subtle);
    padding: 10px 16px;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--cpm-text-muted);
    text-align: left;
    border-bottom: 1px solid var(--cpm-border);
}
.cpm-mini-table tbody td { padding: 10px 16px; border-bottom: 1px solid var(--cpm-border); color: var(--cpm-text-secondary); }
.cpm-mini-table tbody tr:last-child td { border-bottom: none; }

/* ── Forms ─────────────────────────────────────────────────── */
.cpm-form-group { margin-bottom: 1rem; }
.cpm-form-label { display: block; font-size: 14px; font-weight: 600; color: var(--cpm-text); margin-bottom: 6px; }
.cpm-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--cpm-border);
    border-radius: var(--cpm-radius);
    font-family: inherit;
    font-size: 14px;
    color: var(--cpm-text);
    background: var(--cpm-bg);
    resize: vertical;
    line-height: 1.5;
    transition: border-color var(--cpm-transition), box-shadow var(--cpm-transition);
}
.cpm-textarea:focus { outline: none; border-color: var(--cpm-primary); box-shadow: 0 0 0 3px var(--cpm-primary-light); }
.cpm-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 1rem;
    font-size: 14px;
    cursor: pointer;
    line-height: 1.5;
}
.cpm-checkbox-label input[type="checkbox"] { margin-top: 3px; flex-shrink: 0; }

/* ── Buttons ───────────────────────────────────────────────── */
.cpm-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    border: 1px solid transparent;
    border-radius: var(--cpm-radius);
    cursor: pointer;
    line-height: 1.4;
    transition: background var(--cpm-transition), box-shadow var(--cpm-transition);
}
.cpm-btn:disabled { cursor: not-allowed; }
.cpm-btn--outline { background: transparent; }
.cpm-btn--primary { background: var(--cpm-primary); color: #fff; }
.cpm-btn--primary:hover { background: var(--cpm-primary-hover); box-shadow: var(--cpm-shadow); }
.cpm-btn--danger { background: var(--cpm-danger); color: #fff; }
.cpm-btn--danger:hover { background: #991b1b; box-shadow: var(--cpm-shadow); }

/* ── External link ─────────────────────────────────────────── */
.cpm-link-external {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--cpm-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 1rem;
}
.cpm-link-external:hover { text-decoration: underline; }

/* ── Empty state ───────────────────────────────────────────── */
.cpm-empty-state { text-align: center; padding: 3rem 2rem; color: var(--cpm-text-muted); }
.cpm-empty-state p { font-size: 14px; margin: 0; }

/* ── Phone badge ────────────────────────────────────────────── */
.cpm-phone-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--cpm-primary-light);
    border: 1px solid #bfdbfe;
    border-radius: var(--cpm-radius);
    text-decoration: none;
    color: var(--cpm-primary);
    transition: background var(--cpm-transition), border-color var(--cpm-transition), box-shadow var(--cpm-transition);
}
.cpm-phone-badge:hover {
    background: #bfdbfe;
    border-color: #93c5fd;
    box-shadow: var(--cpm-shadow);
    text-decoration: none;
    color: var(--cpm-primary-hover);
}
.cpm-phone-badge__icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--cpm-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.cpm-phone-badge__label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--cpm-primary);
    display: block;
    line-height: 1.2;
}
.cpm-phone-badge__number {
    font-size: 16px;
    font-weight: 700;
    color: var(--cpm-primary-hover);
    letter-spacing: .01em;
}
.cpm-phone-badge__label,
.cpm-phone-badge__number {
    display: block;
}
.cpm-phone-badge > span:not(.cpm-phone-badge__icon) {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* ── Login card ────────────────────────────────────────────── */
.cpm-login-card { max-width: 420px; }
.cpm-login-card .login-username,
.cpm-login-card .login-password,
.cpm-login-card .login-remember { margin-bottom: 1rem; }
.cpm-login-card .login-username label,
.cpm-login-card .login-password label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--cpm-text-secondary);
    margin-bottom: 5px;
}
.cpm-login-card .login-username input,
.cpm-login-card .login-password input {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    font-family: inherit;
    border: 1px solid var(--cpm-border);
    border-radius: var(--cpm-radius-sm);
    background: var(--cpm-bg);
    color: var(--cpm-text);
    box-sizing: border-box;
    transition: border-color var(--cpm-transition), box-shadow var(--cpm-transition);
}
.cpm-login-card .login-username input:focus,
.cpm-login-card .login-password input:focus {
    outline: none;
    border-color: var(--cpm-primary);
    box-shadow: 0 0 0 3px var(--cpm-primary-light);
}
.cpm-login-card .login-remember label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--cpm-text-secondary);
    cursor: pointer;
}
.cpm-login-card .login-submit input[type="submit"] {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--cpm-radius);
    cursor: pointer;
    line-height: 1.4;
    background: var(--cpm-primary);
    color: #fff;
    transition: background var(--cpm-transition), box-shadow var(--cpm-transition);
}
.cpm-login-card .login-submit input[type="submit"]:hover {
    background: var(--cpm-primary-hover);
    box-shadow: var(--cpm-shadow);
}

/* ── Notices (legacy shortcode compat) ─────────────────────── */
.cpm-notice { padding: 10px 16px; border-radius: var(--cpm-radius); background: var(--cpm-bg-muted); font-size: 14px; margin-bottom: 1rem; }
.cpm-notice--success { background: var(--cpm-success-light); border-left: 3px solid var(--cpm-success); }
.cpm-notice--warning { background: var(--cpm-warning-light); border-left: 3px solid var(--cpm-warning); }

/* ── Role badge ────────────────────────────────────────────── */
.cpm-status-item--role { margin-left: auto; }
.cpm-role-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 20px;
    font-size: 12px; font-weight: 600;
}
.cpm-role-badge--primary { background: var(--cpm-role-primary-bg, #fef9c3); color: var(--cpm-role-primary-text, #854d0e); border: 1px solid var(--cpm-role-primary-border, #fde047); }
.cpm-role-badge--contact { background: var(--cpm-bg-muted); color: var(--cpm-text-secondary); border: 1px solid var(--cpm-border); }

/* ── Edit trigger ──────────────────────────────────────────── */
.cpm-edit-trigger-wrap { margin-top: 16px; }

/* ── Inline edit form ──────────────────────────────────────── */
.cpm-edit-form-wrap {
    margin-top: 16px;
    background: var(--cpm-bg);
    border: 1px solid var(--cpm-border);
    border-radius: var(--cpm-radius);
    overflow: hidden;
}
.cpm-edit-form-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px;
    background: var(--cpm-bg-subtle);
    border-bottom: 1px solid var(--cpm-border);
}
.cpm-edit-form-title {
    margin: 0; font-size: 15px; font-weight: 600; color: var(--cpm-text);
    display: flex; align-items: center; gap: 8px;
}
.cpm-edit-form { padding: 20px; }
.cpm-edit-sections { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 680px) { .cpm-edit-sections { grid-template-columns: 1fr; } }
.cpm-edit-section-title {
    margin: 0 0 14px; font-size: 11px; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: var(--cpm-text-secondary);
    border-bottom: 1px solid var(--cpm-border); padding-bottom: 8px;
}
.cpm-edit-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cpm-edit-field { display: flex; flex-direction: column; gap: 5px; }
.cpm-edit-field--full { grid-column: 1 / -1; }
.cpm-edit-field label { font-size: 12px; font-weight: 600; color: var(--cpm-text-secondary); }
.cpm-edit-field input {
    padding: 8px 12px; font-size: 14px; font-family: inherit;
    border: 1px solid var(--cpm-border); border-radius: var(--cpm-radius-sm);
    background: var(--cpm-bg); color: var(--cpm-text);
    transition: border-color .15s, box-shadow .15s;
    width: 100%; box-sizing: border-box;
}
.cpm-edit-field input:focus {
    outline: none; border-color: var(--cpm-primary);
    box-shadow: 0 0 0 3px var(--cpm-primary-light);
}
.cpm-edit-form-footer {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 20px; border-top: 1px solid var(--cpm-border);
    background: var(--cpm-bg-subtle);
}

/* ── Hosting backup form ───────────────────────────────────── */
.cpm-hosting-form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}
.cpm-select {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    font-family: inherit;
    border: 1px solid var(--cpm-border);
    border-radius: var(--cpm-radius-sm);
    background: var(--cpm-bg);
    color: var(--cpm-text);
    transition: border-color var(--cpm-transition), box-shadow var(--cpm-transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}
.cpm-select:focus {
    outline: none;
    border-color: var(--cpm-primary);
    box-shadow: 0 0 0 3px var(--cpm-primary-light);
}

/* ── Unified Tiles (wmi-tile) – Frontend ──────────────────── */
.wmi-tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}
.wmi-tile {
    background: var(--cpm-bg);
    border: 1px solid var(--cpm-border);
    border-top: 3px solid var(--cpm-primary);
    border-radius: var(--cpm-radius);
    box-shadow: var(--cpm-shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow var(--cpm-transition), border-color var(--cpm-transition);
}
.wmi-tile:hover { box-shadow: var(--cpm-shadow-md); border-color: var(--cpm-border-hover); }
.wmi-tile__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--cpm-border);
    background: var(--cpm-primary);
    color: #fff;
}
.wmi-tile__header--blue    { background: var(--hpm-tile-blue, var(--cpm-primary)); color: #fff; }
.wmi-tile__header--yellow  { background: var(--hpm-tile-yellow, #f59e0b); color: #78350f; }
.wmi-tile__header--green   { background: var(--hpm-tile-green, #22c55e); color: #14532d; }
.wmi-tile__header--subtle  { background: var(--cpm-bg-subtle); color: var(--cpm-text); }

/* Accent line per header variant – darker shade of header color */
.wmi-tile:has(.wmi-tile__header--blue)    { border-top-color: #1a3f6f; }
.wmi-tile:has(.wmi-tile__header--yellow)  { border-top-color: #b45309; }
.wmi-tile:has(.wmi-tile__header--green)   { border-top-color: #15803d; }
.wmi-tile:has(.wmi-tile__header--subtle)  { border-top-color: var(--cpm-border); }
.wmi-tile__icon {
    width: 32px;
    height: 32px;
    border-radius: var(--cpm-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(255,255,255,.2);
}
.wmi-tile__header--subtle .wmi-tile__icon { background: var(--cpm-primary-light); color: var(--cpm-primary); }
.wmi-tile__title {
    flex: 1;
    font-size: 14px;
    font-weight: 700;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wmi-tile__badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 99px;
    white-space: nowrap;
    flex-shrink: 0;
}
.wmi-tile__badge--ok      { background: rgba(255,255,255,.25); color: #fff; }
.wmi-tile__badge--warn    { background: rgba(0,0,0,.1); color: inherit; }
.wmi-tile__badge--neutral { background: rgba(255,255,255,.2); color: rgba(255,255,255,.8); }
.wmi-tile__header--subtle .wmi-tile__badge--ok      { background: var(--cpm-success-light); color: var(--cpm-success); }
.wmi-tile__header--subtle .wmi-tile__badge--warn    { background: var(--cpm-warning-light); color: var(--cpm-warning); }
.wmi-tile__header--subtle .wmi-tile__badge--neutral { background: var(--cpm-bg-muted); color: var(--cpm-text-muted); }
.wmi-tile__body {
    padding: 12px 16px;
    flex: 1;
    font-size: 13px;
}
.wmi-tile__row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 5px 0;
}
.wmi-tile__row + .wmi-tile__row { border-top: 1px solid var(--cpm-border); }
.wmi-tile__label {
    flex: 0 0 80px;
    font-size: 11px;
    font-weight: 600;
    color: var(--cpm-text-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
    padding-top: 1px;
}
.wmi-tile__value {
    flex: 1;
    font-size: 13px;
    color: var(--cpm-text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}
.wmi-tile__actions {
    display: flex;
    gap: 6px;
    padding: 8px 16px;
    border-top: 1px solid var(--cpm-border);
    background: var(--cpm-bg-subtle);
    margin-top: auto;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 600px) {
    .cpm-status-bar { flex-direction: column; }
    .cpm-status-item { flex-direction: row; justify-content: space-between; border-right: none; border-bottom: 1px solid var(--cpm-border); padding: 10px 16px; }
    .cpm-status-item:last-child { border-bottom: none; }
    .cpm-tab { padding: 10px 8px; font-size: 11px; gap: 3px; flex: 1; min-width: 0; }
    .cpm-tab-icon svg { width: 18px; height: 18px; }
    .cpm-card-grid, .cpm-contacts-grid { grid-template-columns: 1fr; }
    .cpm-data-row { flex-direction: column; gap: 2px; }
    .cpm-data-row dt { flex: none; }
    .cpm-hosting-form-row { flex-direction: column; }
    .cpm-hosting-form-row .cpm-form-group { width: 100%; }
    .wmi-tile-grid { grid-template-columns: 1fr; }
}
