/* ─── Notes badge trong bảng ─── */
.notes-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
    user-select: none;
}
.notes-badge--has-notes {
    background: #dbeafe;
    color: #1e40af;
}
.notes-badge--has-notes:hover {
    background: #bfdbfe;
    transform: scale(1.05);
}
.notes-badge--empty {
    background: transparent;
    color: #94a3b8;
    border: 1px dashed #cbd5e1;
    font-size: 11px;
    padding: 2px 6px;
}
.notes-badge--empty:hover {
    background: #f1f5f9;
    color: #64748b;
    border-color: #94a3b8;
}

/* ─── Notes Chat Modal — scope bên trong modal chung ─── */
.notes-chat-modal {
    max-width: 500px;
}
.notes-chat-modal .modal-body {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.notes-chat-scope {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 400px;
    padding: 16px 20px 0;
}

/* Body — cuộn */
.notes-chat-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Message row */
.notes-chat-msg-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}
.notes-chat-msg-row--own {
    align-items: flex-end;
}

/* Meta (tên người dùng) */
.notes-chat-msg-meta {
    padding: 0 4px;
}
.notes-chat-msg-user {
    font-weight: 700;
    color: #475569;
    font-size: 12px;
}

/* Inner row: bubble + actions */
.notes-chat-msg-inner {
    display: flex;
    align-items: stretch;
    gap: 4px;
    max-width: 100%;
}
.notes-chat-msg-inner--other {
    flex-direction: row;
}
.notes-chat-msg-inner--own {
    flex-direction: row-reverse;
}

/* Actions (bên ngoài bubble) */
.notes-chat-msg-inner .notes-chat-msg-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
    align-self: center;
}
.notes-chat-msg-inner:hover .notes-chat-msg-actions {
    opacity: 1;
}
.notes-chat-btn-icon {
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    font-size: 11px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.notes-chat-btn-icon:hover {
    background: rgba(0,0,0,0.08);
}

/* Bubble */
.notes-chat-msg-bubble {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 12px 12px 12px 4px;
    padding: 8px 12px;
}
.notes-chat-msg-bubble--own {
    background: #dbeafe;
    border-color: #bfdbfe;
    border-radius: 12px 12px 4px 12px;
}
.notes-chat-msg-content {
    color: #1e293b;
    font-size: 13px;
    white-space: pre-wrap;
    line-height: 1.5;
}
.notes-chat-msg-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 4px;
}
.notes-chat-msg-bubble--own .notes-chat-msg-footer {
    justify-content: flex-start;
}
.notes-chat-msg-time {
    color: #94a3b8;
    font-size: 10px;
}
.notes-chat-msg-edited {
    color: #94a3b8;
    font-size: 9px;
    font-style: italic;
}
.notes-chat-msg-edit {
    margin-top: 4px;
}
.notes-chat-msg-edit .notes-chat-input {
    width: 100%;
    min-width: 260px;
    margin-bottom: 6px;
}
.notes-chat-edit-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}
.notes-chat-edit-actions .notes-chat-btn-icon {
    width: 24px;
    height: 24px;
    font-size: 13px;
}

/* Empty state */
.notes-chat-empty {
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
    font-style: italic;
    padding: 32px 0;
}

/* Footer */
.notes-chat-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    flex-shrink: 0;
    padding: 12px 0;
    border-top: 1px solid #e2e8f0;
    margin-top: 8px;
}
.notes-chat-footer .notes-chat-input {
    flex: 1;
    resize: none;
    min-height: 44px;
    max-height: 100px;
}
.notes-chat-btn-send-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border: none;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
    padding: 0;
}
.notes-chat-btn-send-icon:hover:not(:disabled) {
    background: #1d4ed8;
}
.notes-chat-btn-send-icon:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.notes-chat-btn-loading {
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

/* Shared input */
.notes-chat-input {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}
.notes-chat-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}

/* Buttons */
.notes-chat-btn {
    border: none;
    border-radius: 8px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.notes-chat-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.notes-chat-btn-save {
    background: #16a34a;
    color: #fff;
}
.notes-chat-btn-save:hover:not(:disabled) {
    background: #15803d;
}
.notes-chat-btn-cancel {
    background: #e2e8f0;
    color: #475569;
}
.notes-chat-btn-cancel:hover {
    background: #cbd5e1;
}
