.nlh-crm-wrap .required {
    color: #d63638;
}

/* Chặn input/select tràn khung — 'regular-text' của WP core có width cố định (~25em),
   lớn hơn nhiều khung card hẹp (VD form Thêm chi nhánh/phòng ban) gây tràn ra ngoài */
.nlh-crm-wrap input[type="text"],
.nlh-crm-wrap input[type="email"],
.nlh-crm-wrap input[type="url"],
.nlh-crm-wrap input[type="tel"],
.nlh-crm-wrap input[type="date"],
.nlh-crm-wrap input[type="datetime-local"],
.nlh-crm-wrap select,
.nlh-crm-wrap textarea {
    max-width: 100%;
    box-sizing: border-box;
}

/* ==== Filters ==== */
.nlh-crm-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
    align-items: center;
}
.nlh-crm-filters input[type="search"] {
    min-width: 220px;
}

/* ==== Badge mức độ quan tâm ==== */
.nlh-crm-badge {
    display: inline-block;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    line-height: 1.4;
}

/* ==== Bảng danh sách ==== */
.nlh-crm-table td, .nlh-crm-table th {
    vertical-align: middle;
}

/* ==== Trang chi tiết ==== */
.nlh-crm-detail-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 24px;
    align-items: start;
    margin-top: 16px;
}
@media (max-width: 900px) {
    .nlh-crm-detail-grid {
        grid-template-columns: 1fr;
    }
}

.nlh-crm-info-box, .nlh-crm-log-box {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    padding: 16px 20px;
}

.nlh-crm-info-table {
    width: 100%;
    border-collapse: collapse;
}
.nlh-crm-info-table th {
    text-align: left;
    width: 130px;
    padding: 8px 8px 8px 0;
    color: #646970;
    vertical-align: top;
    font-weight: 600;
}
.nlh-crm-info-table td {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f1;
}

/* ==== Form thêm log ==== */
.nlh-crm-add-log-form {
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 20px;
}
.nlh-crm-log-form-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.nlh-crm-log-form-row select {
    flex: 0 0 auto;
}
.nlh-crm-log-form-row input[type="text"] {
    flex: 1;
    min-width: 140px;
}
.nlh-crm-log-form-row input[type="datetime-local"] {
    flex: 1;
    min-width: 180px;
}
.nlh-crm-add-log-form textarea {
    width: 100%;
}
.nlh-crm-log-feedback {
    margin-left: 8px;
    font-style: italic;
}
.nlh-crm-log-feedback.error {
    color: #d63638;
}
.nlh-crm-log-feedback.success {
    color: #00a32a;
}

/* ==== Timeline ==== */
.nlh-crm-timeline-item {
    border-left: 3px solid #2271b1;
    padding: 8px 12px;
    margin-bottom: 14px;
    background: #f9fafb;
    border-radius: 0 4px 4px 0;
    position: relative;
}
.nlh-crm-timeline-meta {
    font-size: 13px;
    color: #646970;
    margin-bottom: 4px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.nlh-crm-timeline-content {
    margin-bottom: 4px;
}
.nlh-crm-timeline-result {
    font-size: 13px;
    color: #2271b1;
}
.nlh-crm-delete-log {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 12px;
    color: #d63638;
    text-decoration: none;
}
.nlh-crm-empty {
    color: #646970;
    font-style: italic;
}

/* ==== Đính kèm file ==== */
.nlh-crm-attachment-field {
    margin-bottom: 8px;
}
.nlh-crm-attachment-field label {
    display: block;
    font-size: 12px;
    color: #646970;
    margin-bottom: 4px;
}
.nlh-crm-attachment-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}
.nlh-crm-attachment-preview-item {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 12px;
}
.nlh-crm-timeline-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0;
}
.nlh-crm-attachment-thumb img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #dcdcde;
    display: block;
}
.nlh-crm-attachment-file {
    display: inline-flex;
    align-items: center;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 12px;
    text-decoration: none;
    height: 64px;
    box-sizing: border-box;
    align-items: center;
}

/* ==== Kanban board ==== */
.nlh-crm-kanban-board {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 16px;
    margin-top: 16px;
}
.nlh-crm-kanban-column {
    flex: 0 0 260px;
    background: #f0f0f1;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    max-height: 75vh;
}
.nlh-crm-kanban-column-header {
    padding: 10px 12px;
    font-weight: 600;
    border-bottom: 1px solid #dcdcde;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.nlh-crm-kanban-count {
    background: #dcdcde;
    border-radius: 10px;
    padding: 1px 8px;
    font-size: 12px;
    font-weight: 400;
}
.nlh-crm-kanban-column-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    min-height: 80px;
}
.nlh-crm-kanban-column-body.nlh-crm-kanban-dragover {
    background: #e5f1fb;
}
.nlh-crm-kanban-card {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 8px;
    cursor: grab;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.nlh-crm-kanban-card.nlh-crm-kanban-dragging {
    opacity: 0.4;
}
.nlh-crm-kanban-card-silent {
    border-left: 3px solid #e53935;
}
.nlh-crm-kanban-card-title {
    font-weight: 600;
    margin-bottom: 4px;
}
.nlh-crm-kanban-card-meta {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 4px;
    flex-wrap: wrap;
}
.nlh-crm-kanban-card-phone {
    font-size: 12px;
    color: #646970;
}
.nlh-crm-kanban-card-project {
    font-size: 12px;
    color: #555;
    margin-bottom: 2px;
}
.nlh-crm-kanban-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f1;
}
.nlh-crm-silent-flag {
    font-size: 12px;
    color: #d63638;
    font-weight: 600;
}

/* ==== Nhắc việc ==== */
.nlh-crm-reminder-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 44px 10px 4px;
    border-bottom: 1px solid #f0f0f1;
    position: relative;
}
.nlh-crm-reminder-item label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.nlh-crm-reminder-item label input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
}
.nlh-crm-reminder-content {
    flex: 1;
    min-width: 0;
    word-break: break-word;
}
.nlh-crm-reminder-done .nlh-crm-reminder-content {
    text-decoration: line-through;
    color: #8c8f94;
}
.nlh-crm-reminder-due {
    font-size: 12px;
    color: #646970;
    padding-left: 26px;
}
.nlh-crm-reminder-overdue .nlh-crm-reminder-due,
.nlh-crm-overdue-label {
    color: #d63638;
    font-weight: 600;
}
.nlh-crm-reminder-item .nlh-crm-delete-reminder {
    position: absolute;
    top: 10px;
    right: 4px;
    color: #d63638;
    font-size: 12px;
    text-decoration: none;
}
/* Nút Xoá trong bảng nhắc việc (wp-admin) — nằm tĩnh trong ô bảng, không dùng absolute */
.wp-list-table .nlh-crm-delete-reminder {
    color: #d63638;
    text-decoration: none;
}
tr.nlh-crm-reminder-overdue {
    background: #fdecea !important;
}

.nlh-crm-approve-form {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 6px;
}

/* Nút icon liên hệ nhanh (Gọi/Zalo/Facebook) - dùng chung admin + frontend */
.nlh-crm-contact-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}
.nlh-crm-contact-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    line-height: 1;
}
.nlh-crm-contact-call {
    background: #2271b1;
}
.nlh-crm-contact-zalo {
    background: #0068ff;
}
.nlh-crm-contact-fb {
    background: #1877f2;
}
.nlh-crm-contact-btn:hover {
    opacity: 0.85;
}
.nlh-crm-contact-btn svg {
    display: block;
}

/* ==== Dashboard ==== */
.nlh-crm-dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin: 20px 0;
}
.nlh-crm-dash-card {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    padding: 18px;
    text-align: center;
    text-decoration: none;
    color: inherit;
    display: block;
}
.nlh-crm-dash-card-warning {
    border-color: #f0d98c;
    background: #fffbea;
}
.nlh-crm-dash-num {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: #1e3a5f;
    line-height: 1.3;
}
.nlh-crm-dash-card-warning .nlh-crm-dash-num {
    color: #b26a00;
}
.nlh-crm-dash-label {
    display: block;
    font-size: 13px;
    color: #646970;
    margin-top: 4px;
}
.nlh-crm-dashboard-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 24px 0;
}
@media (max-width: 900px) {
    .nlh-crm-dashboard-charts {
        grid-template-columns: 1fr;
    }
}
.nlh-crm-chart-box {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    padding: 18px;
}
.nlh-crm-chart-box h2 {
    margin-top: 0;
    font-size: 15px;
}

/* ==== Dropdown sửa nhanh ở bảng danh sách khách hàng ==== */
.nlh-crm-quick-select {
    border: 1px solid #dcdcde;
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 13px;
    background: #fff;
    max-width: 100%;
}
.nlh-crm-quick-select:disabled {
    opacity: 0.6;
}
.nlh-crm-quick-select-badge {
    color: #fff;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    padding: 3px 10px;
    appearance: none;
    -webkit-appearance: none;
    background-position: right 6px center;
    background-repeat: no-repeat;
    cursor: pointer;
}
.nlh-crm-quick-select-badge option {
    color: #000;
    background: #fff;
    font-weight: 400;
}

/* ==== Danh sách nhân sự (cây tổ chức) ==== */
.nlh-crm-staff-tree {
    margin-top: 16px;
    max-width: 800px;
}
.nlh-crm-staff-node {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    padding: 14px 16px;
    margin-bottom: 14px;
}
.nlh-crm-staff-branch-node {
    border-left: 4px solid #1e3a5f;
}
.nlh-crm-staff-dept-node {
    border-left: 3px solid #2271b1;
    margin-left: 24px;
    margin-top: 10px;
    background: #fbfcfe;
}
.nlh-crm-staff-admin-node {
    border-left: 4px solid #d63638;
}
.nlh-crm-staff-node-header {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 10px;
    color: #1e3a5f;
}
.nlh-crm-staff-person {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f1;
    margin-left: 8px;
}
.nlh-crm-staff-person:last-child {
    border-bottom: none;
}
.nlh-crm-staff-name {
    font-weight: 600;
    min-width: 140px;
    color: #2271b1;
    text-decoration: none;
}
.nlh-crm-staff-name:hover {
    text-decoration: underline;
}
.nlh-crm-staff-count {
    font-weight: 400;
    font-size: 13px;
    color: #888;
}
.nlh-crm-staff-customer-count {
    background: #eef7ee;
    color: #2e7d32;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-decoration: none;
}
.nlh-crm-staff-customer-count:hover {
    background: #d9efd9;
}
.nlh-crm-staff-name-plain {
    color: #1d2327;
}
.nlh-crm-staff-delete {
    margin-left: auto;
    color: #d63638;
    font-size: 12px;
    text-decoration: none;
}
.nlh-crm-staff-viewas {
    color: #2271b1;
    font-size: 12px;
    text-decoration: none;
    margin-left: 10px;
}
.nlh-crm-staff-viewas:hover {
    text-decoration: underline;
}
.nlh-crm-staff-title {
    background: #eef2f7;
    color: #1e3a5f;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
}
.nlh-crm-staff-contact {
    font-size: 13px;
    color: #646970;
}
.nlh-crm-staff-extra {
    font-size: 12px;
    color: #888;
}
.nlh-crm-staff-vacant {
    color: #999;
    font-style: italic;
    font-size: 13px;
    margin: 4px 0 4px 8px;
}
.nlh-crm-staff-indent {
    margin-left: 24px;
}

/* ==== Demo data box ==== */
.nlh-crm-demo-box {
    background: #fffbea;
    border: 1px solid #f0d98c;
    border-radius: 6px;
    padding: 14px 18px;
    margin: 16px 0;
}
.nlh-crm-demo-box p {
    margin: 0 0 10px;
}
.nlh-crm-demo-box form {
    display: inline-block;
}
